[Pkg-shadow-commits] r1591 - upstream/trunk/src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Tue Jan 1 14:10:21 UTC 2008
Author: nekral-guest
Date: 2008-01-01 14:10:21 +0000 (Tue, 01 Jan 2008)
New Revision: 1591
Modified:
upstream/trunk/src/grpck.c
Log:
Add missing prototype declarations.
Document the new functions.
Modified: upstream/trunk/src/grpck.c
===================================================================
--- upstream/trunk/src/grpck.c 2008-01-01 14:09:47 UTC (rev 1590)
+++ upstream/trunk/src/grpck.c 2008-01-01 14:10:21 UTC (rev 1591)
@@ -80,6 +80,24 @@
/* local function prototypes */
static void usage (void);
static void delete_member (char **, const char *);
+static void process_flags (int argc, char **argv);
+static void open_files ();
+static void close_files (int changed);
+static int check_members (const char *groupname,
+ char **members,
+ const char *fmt_info,
+ const char *fmt_prompt,
+ const char *fmt_syslog,
+ int *errors);
+static void compare_members_lists (const char *groupname,
+ char **members,
+ char **other_members,
+ const char *file,
+ const char *other_file);
+static void check_grp_file (int *errors, int *changed);
+#ifdef SHADOWGRP
+static void check_sgr_file (int *errors, int *changed);
+#endif
/*
* usage - print syntax message and exit
@@ -111,7 +129,9 @@
}
/*
- * process_flags -
+ * process_flags - parse the command line options
+ *
+ * It will not return if an error is encountered.
*/
static void process_flags (int argc, char **argv)
{
@@ -174,6 +194,12 @@
#endif
}
+/*
+ * open_files - open the shadow database
+ *
+ * In read-only mode, the databases are not locked and are opened
+ * only for reading.
+ */
static void open_files ()
{
/*
@@ -228,6 +254,13 @@
#endif
}
+/*
+ * close_files - close and unlock the password/shadow databases
+ *
+ * If changed is not set, the databases are not closed, and no
+ * changes are committed in the databases. The databases are
+ * unlocked anyway.
+ */
static void close_files (int changed)
{
/*
@@ -260,6 +293,25 @@
(void) gr_unlock ();
}
+/*
+ * check_members - check that every members of a group exist
+ *
+ * If an error is detected, *errors is incremented.
+ *
+ * The user will be prompted for the removal of the non-existent
+ * user.
+ *
+ * If any changes are performed, the return value will be 1,
+ * otherwise check_members() returns 0.
+ *
+ * fmt_info, fmt_prompt, and fmt_syslog are used for logging.
+ * * fmt_info must contain two string flags (%s): for the group's
+ * name and the missing member.
+ * * fmt_prompt must contain one string flags (%s): the missing
+ * member.
+ * * fmt_syslog must contain two string flags (%s): for the
+ * group's name and the missing member.
+ */
static int check_members (const char *groupname,
char **members,
const char *fmt_info,
@@ -296,6 +348,16 @@
return members_changed;
}
+/*
+ * compare_members_lists - make sure the list of members is contained in
+ * another list.
+ *
+ * compare_members_lists() checks that all the members of members are
+ * also in other_members.
+ * file and other_file are used for logging.
+ *
+ * TODO: No changes are performed on the lists.
+ */
static void compare_members_lists (const char *groupname,
char **members,
char **other_members,
@@ -317,6 +379,9 @@
}
}
+/*
+ * check_grp_file - check the content of the group file
+ */
static void check_grp_file (int *errors, int *changed)
{
struct commonio_entry *gre, *tgre;
@@ -503,6 +568,9 @@
}
#ifdef SHADOWGRP
+/*
+ * check_sgr_file - check the content of the shadowed group file (gshadow)
+ */
static void check_sgr_file (int *errors, int *changed)
{
struct group *grp;
More information about the Pkg-shadow-commits
mailing list