* 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:
nekral-guest
2008-09-04 19:35:48 +00:00
parent 3dcaaf87e7
commit a21809cdae
6 changed files with 142 additions and 70 deletions
+20 -10
View File
@@ -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