* src/groupmod.c: Embed gshadow related cleanup in #ifdef
SHADOWGRP.
This commit is contained in:
parent
a402c4db3b
commit
a8e9fc86eb
@ -1,3 +1,8 @@
|
|||||||
|
2009-03-15 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* src/groupmod.c: Embed gshadow related cleanup in #ifdef
|
||||||
|
SHADOWGRP.
|
||||||
|
|
||||||
2009-03-15 Nicolas François <nicolas.francois@centraliens.net>
|
2009-03-15 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* src/usermod.c: get_number() replaced by getlong().
|
* src/usermod.c: get_number() replaced by getlong().
|
||||||
|
@ -81,7 +81,9 @@ static gid_t group_newid;
|
|||||||
|
|
||||||
struct cleanup_info_mod info_passwd;
|
struct cleanup_info_mod info_passwd;
|
||||||
struct cleanup_info_mod info_group;
|
struct cleanup_info_mod info_group;
|
||||||
|
#ifdef SHADOWGRP
|
||||||
struct cleanup_info_mod info_gshadow;
|
struct cleanup_info_mod info_gshadow;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
oflg = false, /* permit non-unique group ID to be specified with -g */
|
oflg = false, /* permit non-unique group ID to be specified with -g */
|
||||||
@ -473,31 +475,41 @@ static void close_files (void)
|
|||||||
static void prepare_failure_reports (void)
|
static void prepare_failure_reports (void)
|
||||||
{
|
{
|
||||||
info_group.name = group_name;
|
info_group.name = group_name;
|
||||||
|
#ifdef SHADOWGRP
|
||||||
info_gshadow.name = group_name;
|
info_gshadow.name = group_name;
|
||||||
|
#endif
|
||||||
info_passwd.name = group_name;
|
info_passwd.name = group_name;
|
||||||
|
|
||||||
info_group.audit_msg = xmalloc (512);
|
info_group.audit_msg = xmalloc (512);
|
||||||
|
#ifdef SHADOWGRP
|
||||||
info_gshadow.audit_msg = xmalloc (512);
|
info_gshadow.audit_msg = xmalloc (512);
|
||||||
|
#endif
|
||||||
info_passwd.audit_msg = xmalloc (512);
|
info_passwd.audit_msg = xmalloc (512);
|
||||||
|
|
||||||
snprintf (info_group.audit_msg, 511,
|
snprintf (info_group.audit_msg, 511,
|
||||||
"changing %s; ", gr_dbname ());
|
"changing %s; ", gr_dbname ());
|
||||||
|
#ifdef SHADOWGRP
|
||||||
snprintf (info_gshadow.audit_msg, 511,
|
snprintf (info_gshadow.audit_msg, 511,
|
||||||
"changing %s; ", sgr_dbname ());
|
"changing %s; ", sgr_dbname ());
|
||||||
|
#endif
|
||||||
snprintf (info_passwd.audit_msg, 511,
|
snprintf (info_passwd.audit_msg, 511,
|
||||||
"changing %s; ", pw_dbname ());
|
"changing %s; ", pw_dbname ());
|
||||||
|
|
||||||
info_group.action = info_group.audit_msg
|
info_group.action = info_group.audit_msg
|
||||||
+ strlen (info_group.audit_msg);
|
+ strlen (info_group.audit_msg);
|
||||||
|
#ifdef SHADOWGRP
|
||||||
info_gshadow.action = info_gshadow.audit_msg
|
info_gshadow.action = info_gshadow.audit_msg
|
||||||
+ strlen (info_gshadow.audit_msg);
|
+ strlen (info_gshadow.audit_msg);
|
||||||
|
#endif
|
||||||
info_passwd.action = info_passwd.audit_msg
|
info_passwd.action = info_passwd.audit_msg
|
||||||
+ strlen (info_passwd.audit_msg);
|
+ strlen (info_passwd.audit_msg);
|
||||||
|
|
||||||
snprintf (info_group.action, 511 - strlen (info_group.audit_msg),
|
snprintf (info_group.action, 511 - strlen (info_group.audit_msg),
|
||||||
"group %s/%d", group_name, group_id);
|
"group %s/%d", group_name, group_id);
|
||||||
|
#ifdef SHADOWGRP
|
||||||
snprintf (info_gshadow.action, 511 - strlen (info_group.audit_msg),
|
snprintf (info_gshadow.action, 511 - strlen (info_group.audit_msg),
|
||||||
"group %s", group_name);
|
"group %s", group_name);
|
||||||
|
#endif
|
||||||
snprintf (info_passwd.action, 511 - strlen (info_group.audit_msg),
|
snprintf (info_passwd.action, 511 - strlen (info_group.audit_msg),
|
||||||
"group %s/%d", group_name, group_id);
|
"group %s/%d", group_name, group_id);
|
||||||
|
|
||||||
@ -507,10 +519,12 @@ static void prepare_failure_reports (void)
|
|||||||
strncat (info_group.action, group_newname,
|
strncat (info_group.action, group_newname,
|
||||||
511 - strlen (info_group.audit_msg));
|
511 - strlen (info_group.audit_msg));
|
||||||
|
|
||||||
|
#ifdef SHADOWGRP
|
||||||
strncat (info_gshadow.action, ", new name: ",
|
strncat (info_gshadow.action, ", new name: ",
|
||||||
511 - strlen (info_gshadow.audit_msg));
|
511 - strlen (info_gshadow.audit_msg));
|
||||||
strncat (info_gshadow.action, group_newname,
|
strncat (info_gshadow.action, group_newname,
|
||||||
511 - strlen (info_gshadow.audit_msg));
|
511 - strlen (info_gshadow.audit_msg));
|
||||||
|
#endif
|
||||||
|
|
||||||
strncat (info_passwd.action, ", new name: ",
|
strncat (info_passwd.action, ", new name: ",
|
||||||
511 - strlen (info_passwd.audit_msg));
|
511 - strlen (info_passwd.audit_msg));
|
||||||
@ -521,8 +535,10 @@ static void prepare_failure_reports (void)
|
|||||||
strncat (info_group.action, ", new password",
|
strncat (info_group.action, ", new password",
|
||||||
511 - strlen (info_group.audit_msg));
|
511 - strlen (info_group.audit_msg));
|
||||||
|
|
||||||
|
#ifdef SHADOWGRP
|
||||||
strncat (info_gshadow.action, ", new password",
|
strncat (info_gshadow.action, ", new password",
|
||||||
511 - strlen (info_gshadow.audit_msg));
|
511 - strlen (info_gshadow.audit_msg));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (gflg) {
|
if (gflg) {
|
||||||
strncat (info_group.action, ", new gid: ",
|
strncat (info_group.action, ", new gid: ",
|
||||||
@ -538,15 +554,19 @@ static void prepare_failure_reports (void)
|
|||||||
"%d", group_newid);
|
"%d", group_newid);
|
||||||
}
|
}
|
||||||
info_group.audit_msg[511] = '\0';
|
info_group.audit_msg[511] = '\0';
|
||||||
|
#ifdef SHADOWGRP
|
||||||
info_gshadow.audit_msg[511] = '\0';
|
info_gshadow.audit_msg[511] = '\0';
|
||||||
|
#endif
|
||||||
info_passwd.audit_msg[511] = '\0';
|
info_passwd.audit_msg[511] = '\0';
|
||||||
|
|
||||||
// FIXME: add a system cleanup
|
// FIXME: add a system cleanup
|
||||||
add_cleanup (cleanup_report_mod_group, &info_group);
|
add_cleanup (cleanup_report_mod_group, &info_group);
|
||||||
|
#ifdef SHADOWGRP
|
||||||
if ( is_shadow_grp
|
if ( is_shadow_grp
|
||||||
&& (pflg || nflg)) {
|
&& (pflg || nflg)) {
|
||||||
add_cleanup (cleanup_report_mod_gshadow, &info_gshadow);
|
add_cleanup (cleanup_report_mod_gshadow, &info_gshadow);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (gflg) {
|
if (gflg) {
|
||||||
add_cleanup (cleanup_report_mod_passwd, &info_passwd);
|
add_cleanup (cleanup_report_mod_passwd, &info_passwd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user