[svn-upgrade] Integrating new upstream version, shadow (4.0.1)

This commit is contained in:
nekral-guest
2007-10-07 11:44:59 +00:00
parent 3bc4996775
commit 9db6abfa42
194 changed files with 20217 additions and 14460 deletions

1
lib/.indent.pro vendored
View File

@@ -1,3 +1,4 @@
-kr
-i8
-bad
-pcs

View File

@@ -2,7 +2,7 @@
#include <config.h>
#include "rcsid.h"
RCSID("$Id: commonio.c,v 1.20 2001/09/07 15:35:57 kloczek Exp $")
RCSID("$Id: commonio.c,v 1.22 2001/11/17 13:15:52 malekith Exp $")
#include "defines.h"
#include <sys/stat.h>
@@ -292,35 +292,6 @@ commonio_lock(struct commonio_db *db)
#endif
}
#ifndef NSCD_PID_FILE
#define NSCD_PID_FILE "/var/run/nscd.pid"
#endif
/*
reload_nscd() is called after updating all of the password files,
to tell the "nscd" caching daemon to clear its cache.
Very loosely based on a shadow-utils patch from Red Hat.
*/
static void
reload_nscd(void)
{
#ifdef ENABLE_NSCD_SIGHUP /* not every version of nscd can handle it */
FILE *pidfile;
int pid;
pidfile = fopen(NSCD_PID_FILE, "r");
if (pidfile) {
pid = 0;
fscanf(pidfile, "%d", &pid);
if (pid > 0)
kill(pid, SIGHUP);
fclose(pidfile);
}
#endif
}
static void
dec_lock_count(void)
{
@@ -330,7 +301,8 @@ dec_lock_count(void)
/* Tell nscd when lock count goes to zero,
if any of the files were changed. */
if (nscd_need_reload) {
reload_nscd();
nscd_flush_cache("passwd");
nscd_flush_cache("group");
nscd_need_reload = 0;
}
#ifdef HAVE_LCKPWDF
@@ -578,6 +550,8 @@ commonio_sort_wrt(struct commonio_db *shadow, struct commonio_db *passwd)
const char *name;
for (pw_ptr = passwd->head; pw_ptr; pw_ptr = pw_ptr->next) {
if (pw_ptr->eptr == NULL)
continue;
name = passwd->ops->getname(pw_ptr->eptr);
for (spw_ptr = shadow->head; spw_ptr; spw_ptr = spw_ptr->next)
if (strcmp(name, shadow->ops->getname(spw_ptr->eptr)) == 0)

View File

@@ -1,4 +1,4 @@
/* $Id: defines.h,v 1.18 2001/06/28 20:47:05 kloczek Exp $ */
/* $Id: defines.h,v 1.20 2001/11/19 09:23:52 kloczek Exp $ */
/* some useful defines */
#ifndef _DEFINES_H_
@@ -43,6 +43,10 @@ char *strchr(), *strrchr(), *strtok();
# endif
#endif /* not STDC_HEADERS */
#if HAVE_ERRNO_H
# include <errno.h>
#endif
/* Solaris 2.4 defines __SVR4, but not SVR4 -j. */
#ifdef __SVR4

View File

@@ -30,7 +30,7 @@
#include <config.h>
#include "rcsid.h"
RCSID("$Id: getdef.c,v 1.14 2000/08/26 18:27:17 marekm Exp $")
RCSID("$Id: getdef.c,v 1.15 2002/01/06 14:08:00 kloczek Exp $")
#include "prototypes.h"
#include "defines.h"
@@ -201,6 +201,29 @@ getdef_num(const char *item, int dflt)
}
/*
* getdef_unum - get unsigned numerical value from table of definitions
*
* Returns numeric value of specified item, else the "dflt" value if
* the item is not defined. Octal (leading "0") and hex (leading "0x")
* values are handled.
*/
unsigned int
getdef_unum(const char *item, unsigned int dflt)
{
struct itemdef *d;
if (!def_loaded)
def_load();
if ((d = def_find(item)) == NULL || d->value == NULL)
return dflt;
return (unsigned int) strtoul(d->value, (char **)NULL, 0);
}
/*
* getdef_long - get long integer value from table of definitions
*

View File

@@ -5,6 +5,7 @@
extern int getdef_bool(const char *);
extern long getdef_long(const char *, long);
extern int getdef_num(const char *, int);
extern unsigned int getdef_unum(const char *, unsigned int);
extern char *getdef_str(const char *);
extern int putdef_str(const char *, const char *);

View File

@@ -31,7 +31,7 @@
#include <config.h>
#include "rcsid.h"
RCSID("$Id: getpass.c,v 1.10 1999/08/27 19:02:51 marekm Exp $")
RCSID("$Id: getpass.c,v 1.11 2001/11/16 14:53:48 kloczek Exp $")
#include "defines.h"
@@ -267,7 +267,9 @@ out:
#else
(void) signal (SIGINT, old_signal);
#endif
#if 0
out2:
#endif
if (tty_opened)
(void) fclose(ifp);