* lib/prototypes.h, libmisc/audit_help.c: Define new type
shadow_audit_result for the result argument of audit_logger(). This permits stronger type checking and a better readability of the results (SHADOW_AUDIT_FAILURE/SHADOW_AUDIT_SUCCESS constants). * src/groupadd.c, src/groupdel.c, src/useradd.c, src/userdel.c: Use the SHADOW_AUDIT_FAILURE/SHADOW_AUDIT_SUCCESS results instead of 0 or 1 in audit_logger().
This commit is contained in:
parent
3dcaaf87e7
commit
a21809cdae
@ -136,8 +136,12 @@ extern int audit_fd;
|
||||
extern void audit_help_open (void);
|
||||
/* Use AUDIT_NO_ID when a name is provided to audit_logger instead of an ID */
|
||||
#define AUDIT_NO_ID ((unsigned int) -1)
|
||||
typedef enum {
|
||||
SHADOW_AUDIT_FAILURE = 0,
|
||||
SHADOW_AUDIT_SUCCESS = 1} shadow_audit_result;
|
||||
extern void audit_logger (int type, const char *pgname, const char *op,
|
||||
const char *name, unsigned int id, int result);
|
||||
const char *name, unsigned int id,
|
||||
shadow_audit_result result);
|
||||
#endif
|
||||
|
||||
/* limits.c */
|
||||
|
@ -76,13 +76,14 @@ void audit_help_open (void)
|
||||
* result - 1 is "success" and 0 is "failed"
|
||||
*/
|
||||
void audit_logger (int type, const char *pgname, const char *op,
|
||||
const char *name, unsigned int id, int result)
|
||||
const char *name, unsigned int id,
|
||||
shadow_audit_result result)
|
||||
{
|
||||
if (audit_fd < 0) {
|
||||
return;
|
||||
} else {
|
||||
audit_log_acct_message (audit_fd, type, NULL, op, name, id,
|
||||
NULL, NULL, NULL, result);
|
||||
NULL, NULL, NULL, (int) result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,8 @@ static void grp_update (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"adding group",
|
||||
group_name, (unsigned int) group_id, 1);
|
||||
group_name, (unsigned int) group_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "new group: name=%s, GID=%u",
|
||||
group_name, (unsigned int) group_id));
|
||||
@ -264,7 +265,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"unlocking group file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -283,7 +285,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"unlocking gshadow file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -306,7 +309,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"locking group file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -317,7 +321,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"opening group file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -330,7 +335,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"locking gshadow file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -342,7 +348,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"opening gshadow file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -362,7 +369,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"unlocking group file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -375,7 +383,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"unlocking gshadow file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -386,7 +395,8 @@ static void fail_exit (int code)
|
||||
if (code != E_SUCCESS) {
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"adding group",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -101,7 +101,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"unlocking group file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -114,7 +115,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"unlocking gshadow file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -124,7 +126,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"deleting group",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
|
||||
exit (code);
|
||||
@ -170,7 +173,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"deleting group",
|
||||
group_name, (unsigned int) group_id, 1);
|
||||
group_name, (unsigned int) group_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "remove group '%s'\n", group_name));
|
||||
|
||||
@ -185,7 +189,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"unlocking group file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -205,7 +210,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"unlocking gshadow file",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -376,7 +382,8 @@ int main (int argc, char **argv)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"deleting group",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
exit (E_NOTFOUND);
|
||||
}
|
||||
@ -398,7 +405,8 @@ int main (int argc, char **argv)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"deleting group",
|
||||
group_name, AUDIT_NO_ID, 0);
|
||||
group_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
if (!yp_get_default_domain (&nis_domain) &&
|
||||
!yp_master (nis_domain, "group.byname", &nis_master)) {
|
||||
|
@ -205,7 +205,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking shadow file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -217,7 +218,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking passwd file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -229,7 +231,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking group file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -242,7 +245,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking gshadow file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -252,7 +256,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "failed adding user '%s', data deleted", user_name));
|
||||
exit (code);
|
||||
@ -582,7 +587,8 @@ static int set_defaults (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_USYS_CONFIG, Prog,
|
||||
"changing useradd defaults",
|
||||
NULL, AUDIT_NO_ID, 1);
|
||||
NULL, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO,
|
||||
"useradd defaults: GROUP=%u, HOME=%s, SHELL=%s, INACTIVE=%ld, "
|
||||
@ -838,7 +844,8 @@ static void grp_update (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user to group",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE); /* XXX */
|
||||
}
|
||||
@ -856,14 +863,16 @@ static void grp_update (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user to group",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user to group",
|
||||
user_name, AUDIT_NO_ID, 1);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "add '%s' to group '%s'",
|
||||
user_name, ngrp->gr_name));
|
||||
@ -905,7 +914,8 @@ static void grp_update (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user to shadow group",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE); /* XXX */
|
||||
}
|
||||
@ -923,14 +933,16 @@ static void grp_update (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user to shadow group",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user to shadow group",
|
||||
user_name, AUDIT_NO_ID, 1);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "add '%s' to shadow group '%s'",
|
||||
user_name, nsgrp->sg_name));
|
||||
@ -1224,7 +1236,8 @@ static void process_flags (int argc, char **argv)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
exit (E_BAD_ARG);
|
||||
}
|
||||
@ -1299,7 +1312,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking shadow file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -1311,7 +1325,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking passwd file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -1322,7 +1337,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking group file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -1335,7 +1351,8 @@ static void close_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"unlocking gshadow file",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -1480,7 +1497,8 @@ static void grp_add (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"adding group",
|
||||
grp.gr_name, AUDIT_NO_ID, 0);
|
||||
grp.gr_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -1495,7 +1513,8 @@ static void grp_add (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"adding group",
|
||||
grp.gr_name, AUDIT_NO_ID, 0);
|
||||
grp.gr_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -1504,7 +1523,8 @@ static void grp_add (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_GROUP, Prog,
|
||||
"adding group",
|
||||
grp.gr_name, AUDIT_NO_ID, 1);
|
||||
grp.gr_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
do_grp_update = true;
|
||||
}
|
||||
@ -1618,14 +1638,16 @@ static void usr_update (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding shadow password",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -1655,7 +1677,8 @@ static void create_home (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding home directory",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_HOMEDIR);
|
||||
}
|
||||
@ -1666,7 +1689,8 @@ static void create_home (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding home directory",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -1813,7 +1837,8 @@ int main (int argc, char **argv)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_NAME_IN_USE);
|
||||
}
|
||||
@ -1833,7 +1858,8 @@ int main (int argc, char **argv)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding group",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_NAME_IN_USE);
|
||||
}
|
||||
@ -1867,7 +1893,8 @@ int main (int argc, char **argv)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_ADD_USER, Prog,
|
||||
"adding user",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_UID_IN_USE);
|
||||
}
|
||||
|
@ -179,7 +179,8 @@ static void update_groups (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting user from group",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "delete '%s' from group '%s'\n",
|
||||
user_name, ngrp->gr_name));
|
||||
@ -235,7 +236,8 @@ static void update_groups (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_GROUP, Prog,
|
||||
"deleting group",
|
||||
grp->gr_name, AUDIT_NO_ID, 1);
|
||||
grp->gr_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO,
|
||||
"removed group '%s' owned by '%s'\n",
|
||||
@ -293,7 +295,8 @@ static void update_groups (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting user from shadow group",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "delete '%s' from shadow group '%s'\n",
|
||||
user_name, nsgrp->sg_name));
|
||||
@ -416,7 +419,8 @@ static void fail_exit (int code)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting user",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
|
||||
exit (code);
|
||||
@ -437,7 +441,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"locking password file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
@ -448,7 +453,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"opening password file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
@ -460,7 +466,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"locking shadow password file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
@ -472,7 +479,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"opening shadow password file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_PW_UPDATE);
|
||||
}
|
||||
@ -484,7 +492,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"locking group file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -494,7 +503,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"opening group file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -507,7 +517,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"locking shadow group file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -518,7 +529,8 @@ static void open_files (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"opening shadow group file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
fail_exit (E_GRP_UPDATE);
|
||||
}
|
||||
@ -549,7 +561,8 @@ static void update_user (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting user entries",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
#endif
|
||||
SYSLOG ((LOG_INFO, "delete user '%s'\n", user_name));
|
||||
}
|
||||
@ -591,7 +604,8 @@ static void user_busy (const char *name, uid_t uid)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting user logged in",
|
||||
name, AUDIT_NO_ID, 0);
|
||||
name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
exit (E_USER_BUSY);
|
||||
}
|
||||
@ -701,7 +715,8 @@ static void remove_mailbox (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting mail file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -710,7 +725,8 @@ static void remove_mailbox (void)
|
||||
{
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting mail file",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
@ -724,7 +740,8 @@ static void remove_mailbox (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting mail file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
return;
|
||||
} else if (i == -1) {
|
||||
@ -736,7 +753,8 @@ static void remove_mailbox (void)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting mail file",
|
||||
user_name, (unsigned int) user_id, 0);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
/* continue */
|
||||
}
|
||||
@ -745,7 +763,8 @@ static void remove_mailbox (void)
|
||||
{
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting mail file",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -855,7 +874,8 @@ int main (int argc, char **argv)
|
||||
#ifdef WITH_AUDIT
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting user not found",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
#endif
|
||||
exit (E_NOTFOUND);
|
||||
}
|
||||
@ -951,7 +971,8 @@ int main (int argc, char **argv)
|
||||
{
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting home directory",
|
||||
user_name, (unsigned int) user_id, 1);
|
||||
user_name, (unsigned int) user_id,
|
||||
SHADOW_AUDIT_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -959,7 +980,8 @@ int main (int argc, char **argv)
|
||||
if (0 != errors) {
|
||||
audit_logger (AUDIT_DEL_USER, Prog,
|
||||
"deleting home directory",
|
||||
user_name, AUDIT_NO_ID, 0);
|
||||
user_name, AUDIT_NO_ID,
|
||||
SHADOW_AUDIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user