[TinyLogin] CVS update of tinylogin (applets.c include/group.h
include/grp_.h include/libbb.h include/password.h
include/pwd_.h include/shadow_.h pwd_grp/pwd_grp.c)
Erik Andersen
andersen at codepoet.org
Thu Jul 15 06:52:44 MDT 2004
Date: Thursday, July 15, 2004 @ 06:52:44
Author: andersen
Path: /var/cvs/tinylogin
Added: include/grp_.h (1.1) include/pwd_.h (1.1)
Modified: applets.c (1.1 -> 1.2) include/libbb.h (1.3 -> 1.4)
include/shadow_.h (1.2 -> 1.3) pwd_grp/pwd_grp.c (1.1 -> 1.2)
Removed: include/group.h (1.1) include/password.h (1.1)
Header file cleanup
Index: tinylogin/applets.c
diff -u tinylogin/applets.c:1.1 tinylogin/applets.c:1.2
--- tinylogin/applets.c:1.1 Sat Jun 22 21:09:07 2002
+++ tinylogin/applets.c Thu Jul 15 06:52:43 2004
@@ -50,8 +50,8 @@
#include <sys/stat.h>
#include <ctype.h>
-#include "pwd.h"
-#include "grp.h"
+#include "pwd_.h"
+#include "grp_.h"
static int parse_config_file ( void );
Index: tinylogin/include/group.h
diff -u tinylogin/include/group.h:1.1 tinylogin/include/group.h:removed
--- tinylogin/include/group.h:1.1 Sat Jun 22 21:09:10 2002
+++ tinylogin/include/group.h Thu Jul 15 06:52:44 2004
@@ -1,37 +0,0 @@
-#ifndef __CONFIG_GRP_H
-#define __CONFIG_GRP_H
-
-#if defined USE_SYSTEM_PWD_GRP
-#include <grp.h>
-#else
-
-#include <sys/types.h>
-#include <features.h>
-#include <stdio.h>
-
-/* The group structure */
-struct group
-{
- char *gr_name; /* Group name. */
- char *gr_passwd; /* Password. */
- gid_t gr_gid; /* Group ID. */
- char **gr_mem; /* Member list. */
-};
-
-extern void setgrent __P ((void));
-extern void endgrent __P ((void));
-extern struct group * getgrent __P ((void));
-
-extern struct group * getgrgid __P ((__const gid_t gid));
-extern struct group * getgrnam __P ((__const char * name));
-
-extern struct group * fgetgrent __P ((FILE * file));
-
-extern int setgroups __P ((size_t n, __const gid_t * groups));
-extern int initgroups __P ((__const char * user, gid_t gid));
-
-extern struct group * __getgrent __P ((int grp_fd));
-
-#endif /* USE_SYSTEM_PWD_GRP */
-#endif /* __CONFIG_GRP_H */
-
Index: tinylogin/include/grp_.h
diff -u /dev/null tinylogin/include/grp_.h:1.1
--- /dev/null Thu Jul 15 06:52:44 2004
+++ tinylogin/include/grp_.h Thu Jul 15 06:52:43 2004
@@ -0,0 +1,116 @@
+/* Copyright (C) 1991,92,95,96,97,98,99,2000,01 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * POSIX Standard: 9.2.1 Group Database Access <grp.h>
+ */
+
+
+#if defined USE_SYSTEM_PWD_GRP
+#include <grp.h>
+
+#else
+
+#ifndef _GRP_H
+#define _GRP_H 1
+
+
+#include <sys/types.h>
+#include <features.h>
+#include <stdio.h>
+
+
+/* The group structure. */
+struct group
+{
+ char *gr_name; /* Group name. */
+ char *gr_passwd; /* Password. */
+ gid_t gr_gid; /* Group ID. */
+ char **gr_mem; /* Member list. */
+};
+
+
+/* Rewind the group-file stream. */
+extern void setgrent (void);
+
+/* Close the group-file stream. */
+extern void endgrent (void);
+
+/* Read an entry from the group-file stream, opening it if necessary. */
+extern struct group *getgrent (void);
+
+/* Read a group entry from STREAM. */
+extern struct group *fgetgrent (FILE *__stream);
+
+/* Write the given entry onto the given stream. */
+extern int putgrent (__const struct group *__restrict __p,
+ FILE *__restrict __f);
+
+/* Search for an entry with a matching group ID. */
+extern struct group *getgrgid (gid_t __gid);
+
+/* Search for an entry with a matching group name. */
+extern struct group *getgrnam (__const char *__name);
+
+/* Reentrant versions of some of the functions above.
+
+ PLEASE NOTE: the `getgrent_r' function is not (yet) standardized.
+ The interface may change in later versions of this library. But
+ the interface is designed following the principals used for the
+ other reentrant functions so the chances are good this is what the
+ POSIX people would choose. */
+
+extern int getgrent_r (struct group *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct group **__restrict __result);
+
+/* Search for an entry with a matching group ID. */
+extern int getgrgid_r (gid_t __gid, struct group *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct group **__restrict __result);
+
+/* Search for an entry with a matching group name. */
+extern int getgrnam_r (__const char *__restrict __name,
+ struct group *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct group **__restrict __result);
+
+/* Read a group entry from STREAM. This function is not standardized
+ an probably never will. */
+extern int fgetgrent_r (FILE *__restrict __stream,
+ struct group *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct group **__restrict __result);
+
+/* Set the group set for the current user to GROUPS (N of them). */
+extern int setgroups (size_t __n, __const gid_t *__groups);
+
+/* Store at most *NGROUPS members of the group set for USER into
+ *GROUPS. Also include GROUP. The actual number of groups found is
+ returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. */
+extern int getgrouplist (__const char *__user, gid_t __group,
+ gid_t *__groups, int *__ngroups);
+
+/* Initialize the group set for the current user
+ by reading the group database and using all groups
+ of which USER is a member. Also include GROUP. */
+extern int initgroups (__const char *__user, gid_t __group);
+
+
+#endif /* grp.h */
+#endif
Index: tinylogin/include/libbb.h
diff -u tinylogin/include/libbb.h:1.3 tinylogin/include/libbb.h:1.4
--- tinylogin/include/libbb.h:1.3 Thu Jul 15 05:56:06 2004
+++ tinylogin/include/libbb.h Thu Jul 15 06:52:43 2004
@@ -34,10 +34,11 @@
#ifdef DMALLOC
#include <dmalloc.h>
#endif
-#include "password.h"
-#include "group.h"
+
+#include "pwd_.h"
+#include "grp_.h"
#ifdef CONFIG_FEATURE_SHADOWPASSWDS
-#include "shadow.h"
+#include "shadow_.h"
#endif
#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
Index: tinylogin/include/password.h
diff -u tinylogin/include/password.h:1.1 tinylogin/include/password.h:removed
--- tinylogin/include/password.h:1.1 Sat Jun 22 21:09:10 2002
+++ tinylogin/include/password.h Thu Jul 15 06:52:44 2004
@@ -1,41 +0,0 @@
-#ifndef __CONFIG_PWD_H
-#define __CONFIG_PWD_H
-
-#if defined USE_SYSTEM_PWD_GRP
-#include <pwd.h>
-#else
-
-
-#include <sys/types.h>
-#include <features.h>
-#include <stdio.h>
-
-/* The passwd structure. */
-struct passwd
-{
- char *pw_name; /* Username. */
- char *pw_passwd; /* Password. */
- uid_t pw_uid; /* User ID. */
- gid_t pw_gid; /* Group ID. */
- char *pw_gecos; /* Real name. */
- char *pw_dir; /* Home directory. */
- char *pw_shell; /* Shell program. */
-};
-
-extern void setpwent __P ((void));
-extern void endpwent __P ((void));
-extern struct passwd * getpwent __P ((void));
-
-extern int putpwent __P ((__const struct passwd * __p, FILE * __f));
-extern int getpw __P ((uid_t uid, char *buf));
-
-extern struct passwd * fgetpwent __P ((FILE * file));
-
-extern struct passwd * getpwuid __P ((__const uid_t));
-extern struct passwd * getpwnam __P ((__const char *));
-
-extern struct passwd * __getpwent __P ((__const int passwd_fd));
-
-#endif /* USE_SYSTEM_PWD_GRP */
-#endif /* __CONFIG_PWD_H */
-
Index: tinylogin/include/pwd_.h
diff -u /dev/null tinylogin/include/pwd_.h:1.1
--- /dev/null Thu Jul 15 06:52:44 2004
+++ tinylogin/include/pwd_.h Thu Jul 15 06:52:43 2004
@@ -0,0 +1,106 @@
+/* Copyright (C) 1991,92,95,96,97,98,99,2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * POSIX Standard: 9.2.2 User Database Access <pwd.h>
+ */
+
+#if defined USE_SYSTEM_PWD_GRP
+#include <pwd.h>
+
+#else
+
+#ifndef _PWD_H
+#define _PWD_H 1
+
+#include <sys/types.h>
+#include <features.h>
+#include <stdio.h>
+
+/* The passwd structure. */
+struct passwd
+{
+ char *pw_name; /* Username. */
+ char *pw_passwd; /* Password. */
+ uid_t pw_uid; /* User ID. */
+ gid_t pw_gid; /* Group ID. */
+ char *pw_gecos; /* Real name. */
+ char *pw_dir; /* Home directory. */
+ char *pw_shell; /* Shell program. */
+};
+
+
+/* Rewind the password-file stream. */
+extern void setpwent (void);
+
+/* Close the password-file stream. */
+extern void endpwent (void);
+
+/* Read an entry from the password-file stream, opening it if necessary. */
+extern struct passwd *getpwent (void);
+
+/* Read an entry from STREAM. */
+extern struct passwd *fgetpwent (FILE *__stream);
+
+/* Write the given entry onto the given stream. */
+extern int putpwent (__const struct passwd *__restrict __p,
+ FILE *__restrict __f);
+
+/* Search for an entry with a matching user ID. */
+extern struct passwd *getpwuid (uid_t __uid);
+
+/* Search for an entry with a matching username. */
+extern struct passwd *getpwnam (__const char *__name);
+
+/* Reentrant versions of some of the functions above.
+
+ PLEASE NOTE: the `getpwent_r' function is not (yet) standardized.
+ The interface may change in later versions of this library. But
+ the interface is designed following the principals used for the
+ other reentrant functions so the chances are good this is what the
+ POSIX people would choose. */
+
+extern int getpwent_r (struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+
+extern int getpwuid_r (uid_t __uid,
+ struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+
+extern int getpwnam_r (__const char *__restrict __name,
+ struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+
+
+/* Read an entry from STREAM. This function is not standardized and
+ probably never will. */
+extern int fgetpwent_r (FILE *__restrict __stream,
+ struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+
+/* Re-construct the password-file line for the given uid
+ in the given buffer. This knows the format that the caller
+ will expect, but this need not be the format of the password file. */
+extern int getpw (uid_t __uid, char *__buffer);
+
+#endif /* pwd.h */
+#endif
Index: tinylogin/include/shadow_.h
diff -u /dev/null tinylogin/include/shadow_.h:1.3
--- /dev/null Thu Jul 15 06:52:44 2004
+++ tinylogin/include/shadow_.h Thu Jul 15 06:52:43 2004
@@ -0,0 +1,98 @@
+/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Declaration of types and functions for shadow password suite. */
+
+#ifdef USE_SYSTEM_SHADOW
+#include <shadow.h>
+#else
+
+#ifndef _SHADOW_H
+#define _SHADOW_H 1
+
+#include <stdio.h>
+
+/* Paths to the user database files. */
+#ifndef _PATH_SHADOW
+#define _PATH_SHADOW "/etc/shadow"
+#endif
+#define SHADOW _PATH_SHADOW
+
+
+/* Structure of the password file. */
+struct spwd
+{
+ char *sp_namp; /* Login name. */
+ char *sp_pwdp; /* Encrypted password. */
+ long int sp_lstchg; /* Date of last change. */
+ long int sp_min; /* Minimum number of days between changes. */
+ long int sp_max; /* Maximum number of days between changes. */
+ long int sp_warn; /* Number of days to warn user to change
+ the password. */
+ long int sp_inact; /* Number of days the account may be
+ inactive. */
+ long int sp_expire; /* Number of days since 1970-01-01 until
+ account expires. */
+ unsigned long int sp_flag; /* Reserved. */
+};
+
+
+/* Open database for reading. */
+extern void setspent (void);
+
+/* Close database. */
+extern void endspent (void);
+
+/* Get next entry from database, perhaps after opening the file. */
+extern struct spwd *getspent (void);
+
+/* Get shadow entry matching NAME. */
+extern struct spwd *getspnam (__const char *__name);
+
+/* Read shadow entry from STRING. */
+extern struct spwd *sgetspent (__const char *__string);
+
+/* Read next shadow entry from STREAM. */
+extern struct spwd *fgetspent (FILE *__stream);
+
+/* Write line containing shadow password entry to stream. */
+extern int putspent (__const struct spwd *__p, FILE *__stream);
+
+/* Reentrant versions of some of the functions above. */
+extern int getspent_r (struct spwd *__result_buf, char *__buffer,
+ size_t __buflen, struct spwd **__result);
+
+extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct spwd **__result)__THROW;
+
+extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct spwd **__result);
+
+extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct spwd **__result);
+/* Protect password file against multi writers. */
+extern int lckpwdf (void);
+
+/* Unlock password file. */
+extern int ulckpwdf (void);
+
+#endif /* shadow.h */
+#endif
Index: tinylogin/pwd_grp/pwd_grp.c
diff -u tinylogin/pwd_grp/pwd_grp.c:1.1 tinylogin/pwd_grp/pwd_grp.c:1.2
--- tinylogin/pwd_grp/pwd_grp.c:1.1 Thu Jul 15 05:56:07 2004
+++ tinylogin/pwd_grp/pwd_grp.c Thu Jul 15 06:52:44 2004
@@ -38,9 +38,9 @@
#include <errno.h>
#include <assert.h>
#include <ctype.h>
-#include <pwd.h>
-#include <grp.h>
-#include <shadow.h>
+#include "pwd_.h"
+#include "grp_.h"
+#include "shadow_.h"
#ifndef _PATH_SHADOW
#define _PATH_SHADOW "/etc/shadow"
More information about the tinylogin
mailing list