From: Alejandro Colomar Date: Tue, 22 Jul 2025 22:08:22 +0000 (+0200) Subject: lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25d44fc070e3671f217d9bf6762dde5cb701b5df;p=thirdparty%2Fshadow.git lib/defines.h, lib/, src/: Redefine SYSLOG() as a variadic macro The double parentheses were used to fake a variadic macro with a non-variadic one. With a variadic macro, we remove the weird double parentheses that were needed to call this macro, which BTW were error-prone. This would have prevented the bug fixed in 3f5ae5d5f1fd (2025-09-10; "src/su.c: Fix incorrect (non-matching) parentheses"). Signed-off-by: Alejandro Colomar --- diff --git a/lib/chowntty.c b/lib/chowntty.c index e0271108a..64f63d706 100644 --- a/lib/chowntty.c +++ b/lib/chowntty.c @@ -57,9 +57,9 @@ void chown_tty (const struct passwd *info) fprintf (log_get_logfd(), _("Unable to change owner or mode of tty stdin: %s"), strerror (err)); - SYSLOG ((LOG_WARN, - "unable to change owner or mode of tty stdin for user `%s': %s\n", - info->pw_name, strerror (err))); + SYSLOG(LOG_WARN, + "unable to change owner or mode of tty stdin for user `%s': %s\n", + info->pw_name, strerror(err)); if (EROFS != err) { closelog (); exit (EXIT_FAILURE); diff --git a/lib/cleanup_group.c b/lib/cleanup_group.c index 248fe0c24..010d3a72b 100644 --- a/lib/cleanup_group.c +++ b/lib/cleanup_group.c @@ -25,7 +25,7 @@ void cleanup_report_add_group (void *group_name) { const char *name = group_name; - SYSLOG ((LOG_ERR, "failed to add group %s", name)); + SYSLOG(LOG_ERR, "failed to add group %s", name); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_GROUP, "", @@ -43,7 +43,7 @@ void cleanup_report_del_group (void *group_name) { const char *name = group_name; - SYSLOG ((LOG_ERR, "failed to remove group %s", name)); + SYSLOG(LOG_ERR, "failed to remove group %s", name); #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_GROUP, "", @@ -57,10 +57,7 @@ void cleanup_report_mod_group (void *cleanup_info) const struct cleanup_info_mod *info; info = (const struct cleanup_info_mod *)cleanup_info; - SYSLOG ((LOG_ERR, - "failed to change %s (%s)", - gr_dbname (), - info->action)); + SYSLOG(LOG_ERR, "failed to change %s (%s)", gr_dbname(), info->action); #ifdef WITH_AUDIT audit_logger (AUDIT_GRP_MGMT, info->audit_msg, @@ -75,10 +72,7 @@ void cleanup_report_mod_gshadow (void *cleanup_info) const struct cleanup_info_mod *info; info = (const struct cleanup_info_mod *)cleanup_info; - SYSLOG ((LOG_ERR, - "failed to change %s (%s)", - sgr_dbname (), - info->action)); + SYSLOG(LOG_ERR, "failed to change %s (%s)", sgr_dbname(), info->action); #ifdef WITH_AUDIT audit_logger (AUDIT_GRP_MGMT, info->audit_msg, @@ -98,7 +92,7 @@ void cleanup_report_add_group_group (void *group_name) { const char *name = group_name; - SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, gr_dbname ())); + SYSLOG(LOG_ERR, "failed to add group %s to %s", name, gr_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_GROUP, "adding-group", @@ -118,7 +112,7 @@ void cleanup_report_add_group_gshadow (void *group_name) { const char *name = group_name; - SYSLOG ((LOG_ERR, "failed to add group %s to %s", name, sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to add group %s to %s", name, sgr_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_GRP_MGMT, "adding-shadow-group", @@ -139,9 +133,7 @@ void cleanup_report_del_group_group (void *group_name) { const char *name = group_name; - SYSLOG ((LOG_ERR, - "failed to remove group %s from %s", - name, gr_dbname ())); + SYSLOG(LOG_ERR, "failed to remove group %s from %s", name, gr_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_GROUP, "removing-group", @@ -162,9 +154,7 @@ void cleanup_report_del_group_gshadow (void *group_name) { const char *name = group_name; - SYSLOG ((LOG_ERR, - "failed to remove group %s from %s", - name, sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to remove group %s from %s", name, sgr_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_GRP_MGMT, "removing-shadow-group", @@ -187,7 +177,7 @@ void cleanup_unlock_group (void *process_selinux) fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), log_get_progname(), gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); #ifdef WITH_AUDIT audit_logger_message ("unlocking-group", SHADOW_AUDIT_FAILURE); @@ -209,7 +199,7 @@ void cleanup_unlock_gshadow (void *process_selinux) fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), log_get_progname(), sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); #ifdef WITH_AUDIT audit_logger_message ("unlocking-gshadow", SHADOW_AUDIT_FAILURE); diff --git a/lib/cleanup_user.c b/lib/cleanup_user.c index 0af0c67f1..100fe7342 100644 --- a/lib/cleanup_user.c +++ b/lib/cleanup_user.c @@ -24,7 +24,7 @@ void cleanup_report_add_user (void *user_name) { const char *name = user_name; - SYSLOG ((LOG_ERR, "failed to add user %s", name)); + SYSLOG(LOG_ERR, "failed to add user %s", name); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "", @@ -38,10 +38,7 @@ void cleanup_report_mod_passwd (void *cleanup_info) const struct cleanup_info_mod *info; info = (const struct cleanup_info_mod *)cleanup_info; - SYSLOG ((LOG_ERR, - "failed to change %s (%s)", - pw_dbname (), - info->action)); + SYSLOG(LOG_ERR, "failed to change %s (%s)", pw_dbname(), info->action); #ifdef WITH_AUDIT audit_logger (AUDIT_USER_MGMT, info->audit_msg, @@ -61,7 +58,7 @@ void cleanup_report_add_user_passwd (void *user_name) { const char *name = user_name; - SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, pw_dbname ())); + SYSLOG(LOG_ERR, "failed to add user %s to %s", name, pw_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "adding-user", @@ -81,7 +78,7 @@ void cleanup_report_add_user_shadow (void *user_name) { const char *name = user_name; - SYSLOG ((LOG_ERR, "failed to add user %s to %s", name, spw_dbname ())); + SYSLOG(LOG_ERR, "failed to add user %s to %s", name, spw_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_USER_MGMT, "adding-shadow-user", @@ -103,7 +100,7 @@ void cleanup_unlock_passwd (void *process_selinux) fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), log_get_progname(), pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); #ifdef WITH_AUDIT audit_logger_message ("unlocking-passwd", SHADOW_AUDIT_FAILURE); @@ -124,7 +121,7 @@ void cleanup_unlock_shadow (void *process_selinux) fprintf (log_get_logfd(), _("%s: failed to unlock %s\n"), log_get_progname(), spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); #ifdef WITH_AUDIT audit_logger_message ("unlocking-shadow", SHADOW_AUDIT_FAILURE); diff --git a/lib/defines.h b/lib/defines.h index 3277dfeb3..e7da7cc6f 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -74,7 +74,7 @@ #endif /* cleaner than lots of #ifdefs everywhere - use this as follows: - SYSLOG((LOG_CRIT, "user %s cracked root", user)); */ + SYSLOG(LOG_CRIT, "user %s cracked root", user); */ #ifdef ENABLE_NLS /* Temporarily set LC_TIME to "C" to avoid strange dates in syslog. This is a workaround for a more general syslog(d) design problem - @@ -83,7 +83,7 @@ UDP) socket. -MM */ /* Avoid translated PAM error messages: set LC_ALL to "C". * --Nekral */ -#define SYSLOG(x) \ +#define SYSLOG(...) \ do { \ char *old_locale = setlocale (LC_ALL, NULL); \ char *saved_locale = NULL; \ @@ -93,14 +93,14 @@ if (NULL != saved_locale) { \ (void) setlocale (LC_ALL, "C"); \ } \ - syslog x ; \ + syslog(__VA_ARGS__); \ if (NULL != saved_locale) { \ (void) setlocale (LC_ALL, saved_locale); \ free (saved_locale); \ } \ } while (false) #else /* !ENABLE_NLS */ -#define SYSLOG(x) syslog x +#define SYSLOG(...) syslog(__VA_ARGS__) #endif /* !ENABLE_NLS */ /* The default syslog settings can now be changed here, diff --git a/lib/failure.c b/lib/failure.c index 24b8c5dfe..107c526a3 100644 --- a/lib/failure.c +++ b/lib/failure.c @@ -46,9 +46,9 @@ void failure (uid_t uid, const char *tty, struct faillog *fl) fd = open (FAILLOG_FILE, O_RDWR); if (fd < 0) { - SYSLOG ((LOG_WARN, - "Can't write faillog entry for UID %lu in %s: %m", - (unsigned long) uid, FAILLOG_FILE)); + SYSLOG(LOG_WARN, + "Can't write faillog entry for UID %lu in %s: %m", + (unsigned long) uid, FAILLOG_FILE); return; } @@ -109,9 +109,9 @@ err_write: errno = saved_errno; } err_close: - SYSLOG ((LOG_WARN, - "Can't write faillog entry for UID %lu to %s: %m", - (unsigned long) uid, FAILLOG_FILE)); + SYSLOG(LOG_WARN, + "Can't write faillog entry for UID %lu to %s: %m", + (unsigned long) uid, FAILLOG_FILE); } static bool too_many_failures (const struct faillog *fl) @@ -162,10 +162,10 @@ int failcheck (uid_t uid, struct faillog *fl, bool failed) fd = open (FAILLOG_FILE, failed?O_RDONLY:O_RDWR); if (fd < 0) { - SYSLOG ((LOG_WARN, - "Can't open the faillog file (%s) to check UID %lu: %m; " - "User access authorized.", - FAILLOG_FILE, (unsigned long) uid)); + SYSLOG(LOG_WARN, + "Can't open the faillog file (%s) to check UID %lu: %m; " + "User access authorized.", + FAILLOG_FILE, (unsigned long) uid); return 1; } @@ -224,9 +224,9 @@ err_write: errno = saved_errno; } err_close: - SYSLOG ((LOG_WARN, - "Can't reset faillog entry for UID %lu in %s: %m", - (unsigned long) uid, FAILLOG_FILE)); + SYSLOG(LOG_WARN, + "Can't reset faillog entry for UID %lu in %s: %m", + (unsigned long) uid, FAILLOG_FILE); return 1; } diff --git a/lib/find_new_gid.c b/lib/find_new_gid.c index ea1b8dc98..5540df65d 100644 --- a/lib/find_new_gid.c +++ b/lib/find_new_gid.c @@ -323,9 +323,9 @@ int find_new_gid (bool sys_group, _("%s: Can't get unique system GID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG ((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available GIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -369,9 +369,9 @@ int find_new_gid (bool sys_group, _("%s: Can't get unique system GID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG ((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available GIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -432,9 +432,9 @@ int find_new_gid (bool sys_group, _("%s: Can't get unique GID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG ((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available GIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -478,9 +478,9 @@ int find_new_gid (bool sys_group, _("%s: Can't get unique GID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG ((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available GIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -496,7 +496,7 @@ int find_new_gid (bool sys_group, fprintf (log_get_logfd(), _("%s: Can't get unique GID (no more available GIDs)\n"), log_get_progname()); - SYSLOG ((LOG_WARN, "no more available GIDs on the system")); + SYSLOG(LOG_WARN, "no more available GIDs on the system"); free (used_gids); return -1; } diff --git a/lib/find_new_sub_gids.c b/lib/find_new_sub_gids.c index dda80b097..870c432f8 100644 --- a/lib/find_new_sub_gids.c +++ b/lib/find_new_sub_gids.c @@ -51,7 +51,7 @@ int find_new_sub_gids (id_t *range_start, unsigned long *range_count) fprintf (log_get_logfd(), _("%s: Can't get unique subordinate GID range\n"), log_get_progname()); - SYSLOG ((LOG_WARN, "no more available subordinate GIDs on the system")); + SYSLOG(LOG_WARN, "no more available subordinate GIDs on the system"); return -1; } *range_start = start; diff --git a/lib/find_new_sub_uids.c b/lib/find_new_sub_uids.c index 07a60e3cf..0ec6c4e73 100644 --- a/lib/find_new_sub_uids.c +++ b/lib/find_new_sub_uids.c @@ -51,7 +51,7 @@ int find_new_sub_uids (id_t *range_start, unsigned long *range_count) fprintf (log_get_logfd(), _("%s: Can't get unique subordinate UID range\n"), log_get_progname()); - SYSLOG ((LOG_WARN, "no more available subordinate UIDs on the system")); + SYSLOG(LOG_WARN, "no more available subordinate UIDs on the system"); return -1; } *range_start = start; diff --git a/lib/find_new_uid.c b/lib/find_new_uid.c index 3c5000e3e..ed8d34851 100644 --- a/lib/find_new_uid.c +++ b/lib/find_new_uid.c @@ -322,9 +322,9 @@ int find_new_uid(bool sys_user, _("%s: Can't get unique system UID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG ((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available UIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -368,9 +368,9 @@ int find_new_uid(bool sys_user, _("%s: Can't get unique system UID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available UIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -431,9 +431,9 @@ int find_new_uid(bool sys_user, _("%s: Can't get unique UID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG ((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available UIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -477,9 +477,9 @@ int find_new_uid(bool sys_user, _("%s: Can't get unique UID (%s). " "Suppressing additional messages.\n"), log_get_progname(), strerror (result)); - SYSLOG ((LOG_ERR, + SYSLOG(LOG_ERR, "Error checking available UIDs: %s", - strerror (result))); + strerror(result)); nospam = 1; } /* @@ -495,7 +495,7 @@ int find_new_uid(bool sys_user, fprintf (log_get_logfd(), _("%s: Can't get unique UID (no more available UIDs)\n"), log_get_progname()); - SYSLOG ((LOG_WARN, "no more available UIDs on the system")); + SYSLOG(LOG_WARN, "no more available UIDs on the system"); free (used_uids); return -1; } diff --git a/lib/getdef.c b/lib/getdef.c index b15d06ffe..b3fc9e15b 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -389,7 +389,7 @@ int putdef_str (const char *name, const char *value, const char *srcfile) if (NULL == cp) { (void) fputs (_("Could not allocate space for config info.\n"), log_get_logfd()); - SYSLOG ((LOG_ERR, "could not allocate space for config info")); + SYSLOG(LOG_ERR, "could not allocate space for config info"); return -1; } @@ -436,7 +436,7 @@ static /*@observer@*/ /*@null@*/struct itemdef *def_find (const char *name, cons _("configuration error - unknown item '%s' (notify administrator)\n"), name); if (srcfile != NULL) - SYSLOG ((LOG_CRIT, "shadow: unknown configuration item '%s' in '%s'", name, srcfile)); + SYSLOG(LOG_CRIT, "shadow: unknown configuration item '%s' in '%s'", name, srcfile); out: return NULL; @@ -485,14 +485,14 @@ static void def_load (void) if (error == ECONF_NOFILE) return; - SYSLOG ((LOG_CRIT, "cannot open login definitions [%s]", - econf_errString(error))); + SYSLOG(LOG_CRIT, "cannot open login definitions [%s]", + econf_errString(error)); exit (EXIT_FAILURE); } if ((error = econf_getKeys(defs_file, NULL, &key_number, &keys))) { - SYSLOG ((LOG_CRIT, "cannot read login definitions [%s]", - econf_errString(error))); + SYSLOG(LOG_CRIT, "cannot read login definitions [%s]", + econf_errString(error)); exit (EXIT_FAILURE); } @@ -501,8 +501,8 @@ static void def_load (void) error = econf_getStringValue(defs_file, NULL, keys[i], &value); if (error) { - SYSLOG ((LOG_CRIT, "failed reading key %zu from econf [%s]", - i, econf_errString(error))); + SYSLOG(LOG_CRIT, "failed reading key %zu from econf [%s]", + i, econf_errString(error)); exit (EXIT_FAILURE); } @@ -542,8 +542,8 @@ static void def_load (void) return; int err = errno; - SYSLOG ((LOG_CRIT, "cannot open login definitions %s [%s]", - def_fname, strerror (err))); + SYSLOG(LOG_CRIT, "cannot open login definitions %s [%s]", + def_fname, strerror(err)); exit (EXIT_FAILURE); } @@ -583,8 +583,8 @@ static void def_load (void) if (ferror (fp) != 0) { int err = errno; - SYSLOG ((LOG_CRIT, "cannot read login definitions %s [%s]", - def_fname, strerror (err))); + SYSLOG(LOG_CRIT, "cannot read login definitions %s [%s]", + def_fname, strerror(err)); exit (EXIT_FAILURE); } diff --git a/lib/limits.c b/lib/limits.c index 4c7ac6ab1..fa751104e 100644 --- a/lib/limits.c +++ b/lib/limits.c @@ -121,23 +121,21 @@ static int check_logins (const char *name, const char *maxlogins) if (str2ul(&limit, maxlogins) == -1) { if (errno == ERANGE) { - SYSLOG((LOG_WARN, "Invalid maxlogins value\n")); + SYSLOG(LOG_WARN, "Invalid maxlogins value\n"); return LOGIN_ERROR_LOGIN; } return 0; } if (0 == limit) { /* maximum 0 logins ? */ - SYSLOG ((LOG_WARN, "No logins allowed for `%s'\n", name)); + SYSLOG(LOG_WARN, "No logins allowed for `%s'\n", name); return LOGIN_ERROR_LOGIN; } count = active_sessions_count(name, limit); if (count > limit) { - SYSLOG ((LOG_WARN, - "Too many logins (max %lu) for %s\n", - limit, name)); + SYSLOG(LOG_WARN, "Too many logins (max %lu) for %s\n", limit, name); return LOGIN_ERROR_LOGIN; } return 0; @@ -294,9 +292,7 @@ static int do_user_limits (const char *buf, const char *name) * is still processed */ if (!reported) { - SYSLOG ((LOG_WARN, - "Invalid limit string: '%s'", - pp-1)); + SYSLOG(LOG_WARN, "Invalid limit string: '%s'", pp-1); reported = true; retval |= LOGIN_ERROR_RLIMIT; } @@ -331,8 +327,7 @@ static bool user_in_group (const char *uname, const char *gname) * one needs to add some mess for getgrnam_r. */ groupdata = getgrnam (gname); if (NULL == groupdata) { - SYSLOG ((LOG_WARN, "Nonexisting group `%s' in limits file.", - gname)); + SYSLOG(LOG_WARN, "Nonexisting group `%s' in limits file.", gname); return false; } @@ -487,9 +482,9 @@ void setup_limits (const struct passwd *info) } /* Failed to parse or failed to nice() */ - SYSLOG ((LOG_WARN, - "Can't set the nice value for user %s", - info->pw_name)); + SYSLOG(LOG_WARN, + "Can't set the nice value for user %s", + info->pw_name); continue; } @@ -500,9 +495,9 @@ void setup_limits (const struct passwd *info) if ( (str2si(&blocks, val) == -1) || (set_filesize_limit (blocks) != 0)) { - SYSLOG ((LOG_WARN, - "Can't set the ulimit for user %s", - info->pw_name)); + SYSLOG(LOG_WARN, + "Can't set the ulimit for user %s", + info->pw_name); } continue; } @@ -512,9 +507,9 @@ void setup_limits (const struct passwd *info) mode_t mask; if (str2i(mode_t, &mask, val) == -1) { - SYSLOG ((LOG_WARN, - "Can't set umask value for user %s", - info->pw_name)); + SYSLOG(LOG_WARN, + "Can't set umask value for user %s", + info->pw_name); } else { (void) umask (mask); } diff --git a/lib/log.c b/lib/log.c index 1d5a9b209..52abbead1 100644 --- a/lib/log.c +++ b/lib/log.c @@ -59,9 +59,9 @@ void dolastlog ( offset = (off_t) pw->pw_uid * sizeof(newlog); if (lseek (fd, offset, SEEK_SET) != offset) { - SYSLOG ((LOG_WARN, - "Can't read last lastlog entry for UID %lu in %s. Entry not updated.", - (unsigned long) pw->pw_uid, _PATH_LASTLOG)); + SYSLOG(LOG_WARN, + "Can't read last lastlog entry for UID %lu in %s. Entry not updated.", + (unsigned long) pw->pw_uid, _PATH_LASTLOG); (void) close (fd); return; } @@ -104,7 +104,7 @@ err_write: errno = saved_errno; } err_close: - SYSLOG ((LOG_WARN, - "Can't write lastlog entry for UID %lu in %s: %m", - (unsigned long) pw->pw_uid, _PATH_LASTLOG)); + SYSLOG(LOG_WARN, + "Can't write lastlog entry for UID %lu in %s: %m", + (unsigned long) pw->pw_uid, _PATH_LASTLOG); } diff --git a/lib/pwdcheck.c b/lib/pwdcheck.c index cd85aab68..48bcfb9fb 100644 --- a/lib/pwdcheck.c +++ b/lib/pwdcheck.c @@ -30,7 +30,7 @@ passwd_check(const char *user, const char *passwd) passwd = sp->sp_pwdp; } if (pw_auth(passwd, user) != 0) { - SYSLOG ((LOG_WARN, "incorrect password for `%s'", user)); + SYSLOG(LOG_WARN, "incorrect password for `%s'", user); (void) sleep (1); fprintf (log_get_logfd(), _("Incorrect password for %s.\n"), user); exit (EXIT_FAILURE); diff --git a/lib/selinux.c b/lib/selinux.c index 918be770e..4b6bf8521 100644 --- a/lib/selinux.c +++ b/lib/selinux.c @@ -139,7 +139,7 @@ static int selinux_log_cb (int type, const char *fmt, ...) { (void) fputs (_("Cannot open audit interface.\n"), log_get_logfd()); - SYSLOG ((LOG_WARN, "Cannot open audit interface.")); + SYSLOG(LOG_WARN, "Cannot open audit interface."); } } } @@ -161,7 +161,7 @@ static int selinux_log_cb (int type, const char *fmt, ...) { } #endif - SYSLOG ((LOG_WARN, "libselinux: %s", buf)); + SYSLOG(LOG_WARN, "libselinux: %s", buf); skip_syslog: free (buf); @@ -194,9 +194,9 @@ int check_selinux_permit (const char *perm_name) fprintf (log_get_logfd(), _("%s: can not get previous SELinux process context: %s\n"), log_get_progname(), strerrno()); - SYSLOG ((LOG_WARN, - "can not get previous SELinux process context: %s", - strerrno())); + SYSLOG(LOG_WARN, + "can not get previous SELinux process context: %s", + strerrno()); return (security_getenforce () != 0); } diff --git a/lib/setugid.c b/lib/setugid.c index 3a7191c62..d8a3588bd 100644 --- a/lib/setugid.c +++ b/lib/setugid.c @@ -42,8 +42,8 @@ int setup_groups (const struct passwd *info) if (setgid (info->pw_gid) == -1) { int err = errno; perror ("setgid"); - SYSLOG ((LOG_ERR, "bad group ID `%d' for user `%s': %s\n", - info->pw_gid, info->pw_name, strerror (err))); + SYSLOG(LOG_ERR, "bad group ID `%d' for user `%s': %s\n", + info->pw_gid, info->pw_name, strerror(err)); closelog (); return -1; } @@ -55,8 +55,8 @@ int setup_groups (const struct passwd *info) if (initgroups (info->pw_name, info->pw_gid) == -1) { int err = errno; perror ("initgroups"); - SYSLOG ((LOG_ERR, "initgroups failed for user `%s': %s\n", - info->pw_name, strerror (err))); + SYSLOG(LOG_ERR, "initgroups failed for user `%s': %s\n", + info->pw_name, strerror(err)); closelog (); return -1; } @@ -77,8 +77,8 @@ int change_uid (const struct passwd *info) if (setuid (info->pw_uid) != 0) { int err = errno; perror ("setuid"); - SYSLOG ((LOG_ERR, "bad user ID `%d' for user `%s': %s\n", - (int) info->pw_uid, info->pw_name, strerror (err))); + SYSLOG(LOG_ERR, "bad user ID `%d' for user `%s': %s\n", + (int) info->pw_uid, info->pw_name, strerror(err)); closelog (); return -1; } diff --git a/lib/setupenv.c b/lib/setupenv.c index 43acae2a6..ecda40c21 100644 --- a/lib/setupenv.c +++ b/lib/setupenv.c @@ -115,9 +115,9 @@ void setup_env (struct passwd *info) if (!getdef_bool ("DEFAULT_HOME") || chdir ("/") == -1) { fprintf (log_get_logfd(), _("Unable to cd to '%s'\n"), info->pw_dir); - SYSLOG ((LOG_WARN, - "unable to cd to `%s' for user `%s'\n", - info->pw_dir, info->pw_name)); + SYSLOG(LOG_WARN, + "unable to cd to `%s' for user `%s'\n", + info->pw_dir, info->pw_name); closelog (); exit (EXIT_FAILURE); } diff --git a/lib/sssd.c b/lib/sssd.c index 92d689b95..cc5d4a464 100644 --- a/lib/sssd.c +++ b/lib/sssd.c @@ -56,22 +56,22 @@ sssd_flush_cache(int dbflags) free(sss_cache_args); if (rv != 0) { /* run_command writes its own more detailed message. */ - SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, log_get_progname())); + SYSLOG(LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, log_get_progname()); return -1; } code = WEXITSTATUS (status); if (!WIFEXITED (status)) { - SYSLOG ((LOG_WARN, "%s: sss_cache did not terminate normally (signal %d)", - log_get_progname(), WTERMSIG (status))); + SYSLOG(LOG_WARN, "%s: sss_cache did not terminate normally (signal %d)", + log_get_progname(), WTERMSIG(status)); return -1; } else if (code == E_CMD_NOTFOUND) { /* sss_cache is not installed, or it is installed but uses an interpreter that is missing. Probably the former. */ return 0; } else if (code != 0) { - SYSLOG ((LOG_WARN, "%s: sss_cache exited with status %d", log_get_progname(), code)); - SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, log_get_progname())); + SYSLOG(LOG_WARN, "%s: sss_cache exited with status %d", log_get_progname(), code); + SYSLOG(LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, log_get_progname()); return -1; } diff --git a/lib/sub.c b/lib/sub.c index 4babee529..14d220eb2 100644 --- a/lib/sub.c +++ b/lib/sub.c @@ -36,7 +36,7 @@ void subsystem (const struct passwd *pw) */ if (++depth > MAX_DEPTH) { printf (_("Maximum subsystem depth reached\n")); - SYSLOG ((LOG_WARN, MAX_SUBROOT2)); + SYSLOG(LOG_WARN, MAX_SUBROOT2); closelog (); exit (EXIT_FAILURE); } @@ -47,7 +47,7 @@ void subsystem (const struct passwd *pw) if (pw->pw_dir[0] != '/') { printf (_("Invalid root directory '%s'\n"), pw->pw_dir); - SYSLOG ((LOG_WARN, BAD_SUBROOT2, pw->pw_dir, pw->pw_name)); + SYSLOG(LOG_WARN, BAD_SUBROOT2, pw->pw_dir, pw->pw_name); closelog (); exit (EXIT_FAILURE); } @@ -61,7 +61,7 @@ void subsystem (const struct passwd *pw) || (chdir ("/") != 0)) { (void) printf (_("Can't change root directory to '%s'\n"), pw->pw_dir); - SYSLOG ((LOG_WARN, NO_SUBROOT2, pw->pw_dir, pw->pw_name)); + SYSLOG(LOG_WARN, NO_SUBROOT2, pw->pw_dir, pw->pw_name); closelog (); exit (EXIT_FAILURE); } diff --git a/lib/sulog.c b/lib/sulog.c index db32dde42..787c62614 100644 --- a/lib/sulog.c +++ b/lib/sulog.c @@ -32,11 +32,9 @@ void sulog (const char *tty, bool success, const char *oldname, const char *name gid_t oldgid = 0; if (success) { - SYSLOG ((LOG_INFO, - "Successful su for %s by %s",name,oldname)); + SYSLOG(LOG_INFO, "Successful su for %s by %s", name, oldname); } else { - SYSLOG ((LOG_NOTICE, - "FAILED su for %s by %s",name,oldname)); + SYSLOG(LOG_NOTICE, "FAILED su for %s by %s", name, oldname); } sulog_file = getdef_str ("SULOG_FILE"); @@ -49,8 +47,7 @@ void sulog (const char *tty, bool success, const char *oldname, const char *name /* Switch to group root to avoid creating the sulog file with * the wrong group ownership. */ if ((oldgid != 0) && (setgid (0) != 0)) { - SYSLOG ((LOG_INFO, - "su session not logged to %s", sulog_file)); + SYSLOG(LOG_INFO, "su session not logged to %s", sulog_file); /* Continue, but do not switch back to oldgid later */ oldgid = 0; } @@ -58,9 +55,7 @@ void sulog (const char *tty, bool success, const char *oldname, const char *name (void) umask (oldmask); if ((oldgid != 0) && (setgid (oldgid) != 0)) { perror ("setgid"); - SYSLOG ((LOG_ERR, - "can't switch back to group `%d' in sulog", - oldgid)); + SYSLOG(LOG_ERR, "can't switch back to group `%d' in sulog", oldgid); /* Do not return if the group permission were raised. */ exit (EXIT_FAILURE); } diff --git a/lib/utmp.c b/lib/utmp.c index f5fd2a57e..b18ab2b40 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -102,9 +102,9 @@ failtmp(const char *username, const struct utmpx *failent) fd = open (ftmp, O_WRONLY | O_APPEND); if (-1 == fd) { if (errno != ENOENT) { - SYSLOG ((LOG_WARN, - "Can't append failure of user %s to %s: %m", - username, ftmp)); + SYSLOG(LOG_WARN, + "Can't append failure of user %s to %s: %m", + username, ftmp); } return; } @@ -130,9 +130,7 @@ err_write: errno = saved_errno; } err_close: - SYSLOG ((LOG_WARN, - "Can't append failure of user %s to %s: %m", - username, ftmp)); + SYSLOG(LOG_WARN, "Can't append failure of user %s to %s: %m", username, ftmp); } diff --git a/src/chage.c b/src/chage.c index fffd22b99..8e27c5fd5 100644 --- a/src/chage.c +++ b/src/chage.c @@ -100,14 +100,14 @@ fail_exit (int code, bool process_selinux) if (spw_locked) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -522,7 +522,7 @@ static void open_files(bool readonly, const struct option_flags *flags) } if (pw_open (readonly ? O_RDONLY: O_CREAT | O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", pw_dbname()); fail_exit (E_NOPERM, process_selinux); } @@ -544,7 +544,7 @@ static void open_files(bool readonly, const struct option_flags *flags) if (spw_open (readonly ? O_RDONLY: O_CREAT | O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", spw_dbname()); fail_exit (E_NOPERM, process_selinux); } } @@ -565,7 +565,7 @@ static void close_files(const struct option_flags *flags) if (spw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (E_NOPERM, process_selinux); } @@ -575,18 +575,18 @@ static void close_files(const struct option_flags *flags) */ if (pw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (E_NOPERM, process_selinux); } if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } spw_locked = false; if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } pw_locked = false; @@ -768,7 +768,7 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: the shadow password file is not present\n"), Prog); - SYSLOG ((LOG_WARN, "can't find the shadow password file")); + SYSLOG(LOG_WARN, "can't find the shadow password file"); closelog (); exit (E_SHADOW_NOTFOUND); } @@ -871,7 +871,7 @@ int main (int argc, char **argv) close_files (&flags); - SYSLOG ((LOG_INFO, "changed password expiry for %s", user_name)); + SYSLOG(LOG_INFO, "changed password expiry for %s", user_name); closelog (); exit (E_SUCCESS); diff --git a/src/chfn.c b/src/chfn.c index 81e2a31bb..28117655f 100644 --- a/src/chfn.c +++ b/src/chfn.c @@ -84,7 +84,7 @@ static void fail_exit (int code, bool process_selinux) if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -372,7 +372,7 @@ static void check_perms (const struct passwd *pw) if (PAM_SUCCESS != retval) { fprintf (stderr, _("%s: PAM: %s\n"), Prog, pam_strerror (pamh, retval)); - SYSLOG((LOG_ERR, "%s", pam_strerror (pamh, retval))); + SYSLOG(LOG_ERR, "%s", pam_strerror(pamh, retval)); if (NULL != pamh) { (void) pam_end (pamh, retval); } @@ -403,7 +403,7 @@ static void update_gecos(const char *user, char *gecos, const struct option_flag */ if (setuid (0) != 0) { fputs (_("Cannot change ID to root.\n"), stderr); - SYSLOG ((LOG_ERR, "can't setuid(0)")); + SYSLOG(LOG_ERR, "can't setuid(0)"); fail_exit (E_NOPERM, process_selinux); } pwd_init (); @@ -462,12 +462,12 @@ static void update_gecos(const char *user, char *gecos, const struct option_flag */ if (pw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (E_NOPERM, process_selinux); } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } pw_locked = false; @@ -621,8 +621,8 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) getuid ())); + SYSLOG(LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) getuid()); fail_exit (E_NOPERM, process_selinux); } user = xstrdup (pw->pw_name); @@ -668,7 +668,7 @@ int main (int argc, char **argv) /* Rewrite the user's gecos in the passwd file */ update_gecos (user, new_gecos, &flags); - SYSLOG ((LOG_INFO, "changed user '%s' information", user)); + SYSLOG(LOG_INFO, "changed user '%s' information", user); nscd_flush_cache ("passwd"); sssd_flush_cache (SSSD_DB_PASSWD); diff --git a/src/chgpasswd.c b/src/chgpasswd.c index 71829868e..aec4f63b7 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -81,7 +81,7 @@ static void fail_exit (int code, bool process_selinux) if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -90,7 +90,7 @@ static void fail_exit (int code, bool process_selinux) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -306,12 +306,12 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sgr_dbname()); fail_exit (1, process_selinux); } if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } sgr_locked = false; @@ -322,12 +322,12 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", gr_dbname()); fail_exit (1, process_selinux); } if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } gr_locked = false; diff --git a/src/chpasswd.c b/src/chpasswd.c index 1bff211ec..3c8838d1a 100644 --- a/src/chpasswd.c +++ b/src/chpasswd.c @@ -85,7 +85,7 @@ static void fail_exit (int code, bool process_selinux) if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -93,7 +93,7 @@ static void fail_exit (int code, bool process_selinux) if (spw_locked) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } @@ -310,12 +310,12 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (1, process_selinux); } if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } spw_locked = false; @@ -325,12 +325,12 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (1, process_selinux); } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } pw_locked = false; diff --git a/src/chsh.c b/src/chsh.c index 0cfe26ee8..f1b41e822 100644 --- a/src/chsh.c +++ b/src/chsh.c @@ -84,7 +84,7 @@ fail_exit (int code, bool process_selinux) if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -284,7 +284,7 @@ static void check_perms(const struct passwd *pw, const struct option_flags *flag * UID of the user matches the current real UID. */ if (!amroot && pw->pw_uid != getuid ()) { - SYSLOG ((LOG_WARN, "can't change shell for '%s'", pw->pw_name)); + SYSLOG(LOG_WARN, "can't change shell for '%s'", pw->pw_name); fprintf (stderr, _("You may not change the shell for '%s'.\n"), pw->pw_name); @@ -296,7 +296,7 @@ static void check_perms(const struct passwd *pw, const struct option_flags *flag * is not a restricted one. */ if (!amroot && is_restricted_shell (pw->pw_shell, process_selinux)) { - SYSLOG ((LOG_WARN, "can't change shell for '%s'", pw->pw_name)); + SYSLOG(LOG_WARN, "can't change shell for '%s'", pw->pw_name); fprintf (stderr, _("You may not change the shell for '%s'.\n"), pw->pw_name); @@ -309,7 +309,7 @@ static void check_perms(const struct passwd *pw, const struct option_flags *flag */ if ((pw->pw_uid != getuid ()) && (check_selinux_permit(Prog) != 0)) { - SYSLOG ((LOG_WARN, "can't change shell for '%s'", pw->pw_name)); + SYSLOG(LOG_WARN, "can't change shell for '%s'", pw->pw_name); fprintf (stderr, _("You may not change the shell for '%s'.\n"), pw->pw_name); @@ -350,7 +350,7 @@ static void check_perms(const struct passwd *pw, const struct option_flags *flag if (PAM_SUCCESS != retval) { fprintf (stderr, _("%s: PAM: %s\n"), Prog, pam_strerror (pamh, retval)); - SYSLOG((LOG_ERR, "%s", pam_strerror (pamh, retval))); + SYSLOG(LOG_ERR, "%s", pam_strerror(pamh, retval)); if (NULL != pamh) { (void) pam_end (pamh, retval); } @@ -382,7 +382,7 @@ static void update_shell (const char *user, char *newshell, const struct option_ * keyboard signals are set to be ignored. */ if (setuid (0) != 0) { - SYSLOG ((LOG_ERR, "can't setuid(0)")); + SYSLOG(LOG_ERR, "can't setuid(0)"); fputs (_("Cannot change ID to root.\n"), stderr); fail_exit (1, process_selinux); } @@ -400,7 +400,7 @@ static void update_shell (const char *user, char *newshell, const struct option_ pw_locked = true; if (pw_open (O_CREAT | O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", pw_dbname()); fail_exit (1, process_selinux); } @@ -441,12 +441,12 @@ static void update_shell (const char *user, char *newshell, const struct option_ */ if (pw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (1, process_selinux); } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } pw_locked= false; @@ -510,8 +510,8 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) getuid ())); + SYSLOG(LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) getuid()); fail_exit (1, process_selinux); } user = xstrdup (pw->pw_name); @@ -571,7 +571,7 @@ int main (int argc, char **argv) update_shell (user, loginsh, &flags); - SYSLOG ((LOG_INFO, "changed user '%s' shell to '%s'", user, loginsh)); + SYSLOG(LOG_INFO, "changed user '%s' shell to '%s'", user, loginsh); nscd_flush_cache ("passwd"); sssd_flush_cache (SSSD_DB_PASSWD); diff --git a/src/gpasswd.c b/src/gpasswd.c index 14c8f4f60..f841ede86 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -370,7 +370,7 @@ static void open_files(const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", gr_dbname()); exit (E_NOPERM); } @@ -380,7 +380,7 @@ static void open_files(const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", sgr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", sgr_dbname()); exit (E_NOPERM); } add_cleanup (log_gpasswd_failure_gshadow, NULL); @@ -394,9 +394,8 @@ static void open_files(const struct option_flags *flags) static void log_gpasswd_failure (const char *suffix) { if (aflg) { - SYSLOG ((LOG_ERR, - "%s failed to add user %s to group %s%s", - myname, user, group, suffix)); + SYSLOG(LOG_ERR, "%s failed to add user %s to group %s%s", + myname, user, group, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_USER_MGMT, "add-user-to-group", @@ -404,9 +403,8 @@ static void log_gpasswd_failure (const char *suffix) SHADOW_AUDIT_FAILURE); #endif } else if (dflg) { - SYSLOG ((LOG_ERR, - "%s failed to remove user %s from group %s%s", - myname, user, group, suffix)); + SYSLOG(LOG_ERR, "%s failed to remove user %s from group %s%s", + myname, user, group, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_USER_MGMT, "delete-user-from-group", @@ -414,9 +412,8 @@ static void log_gpasswd_failure (const char *suffix) SHADOW_AUDIT_FAILURE); #endif } else if (rflg) { - SYSLOG ((LOG_ERR, - "%s failed to remove password of group %s%s", - myname, group, suffix)); + SYSLOG(LOG_ERR, "%s failed to remove password of group %s%s", + myname, group, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_GRP_CHAUTHTOK, "delete-group-password", @@ -424,9 +421,8 @@ static void log_gpasswd_failure (const char *suffix) SHADOW_AUDIT_FAILURE); #endif } else if (Rflg) { - SYSLOG ((LOG_ERR, - "%s failed to restrict access to group %s%s", - myname, group, suffix)); + SYSLOG(LOG_ERR, "%s failed to restrict access to group %s%s", + myname, group, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_GRP_MGMT, "restrict-group", @@ -436,9 +432,9 @@ static void log_gpasswd_failure (const char *suffix) } else if (Aflg || Mflg) { #ifdef SHADOWGRP if (Aflg) { - SYSLOG ((LOG_ERR, - "%s failed to set the administrators of group %s to %s%s", - myname, group, admins, suffix)); + SYSLOG(LOG_ERR, + "%s failed to set the administrators of group %s to %s%s", + myname, group, admins, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_GRP_MGMT, "set-admins-of-group", @@ -448,9 +444,9 @@ static void log_gpasswd_failure (const char *suffix) } #endif /* SHADOWGRP */ if (Mflg) { - SYSLOG ((LOG_ERR, - "%s failed to set the members of group %s to %s%s", - myname, group, members, suffix)); + SYSLOG(LOG_ERR, + "%s failed to set the members of group %s to %s%s", + myname, group, members, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_USER_MGMT, "add-users-to-group", @@ -459,9 +455,8 @@ static void log_gpasswd_failure (const char *suffix) #endif } } else { - SYSLOG ((LOG_ERR, - "%s failed to change password of group %s%s", - myname, group, suffix)); + SYSLOG(LOG_ERR, "%s failed to change password of group %s%s", + myname, group, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_GRP_CHAUTHTOK, "change-password", @@ -504,9 +499,8 @@ static void log_gpasswd_success (const char *suffix) #endif if (aflg) { - SYSLOG ((LOG_INFO, - "user %s added by %s to group %s%s", - user, myname, group, suffix)); + SYSLOG(LOG_INFO, "user %s added by %s to group %s%s", + user, myname, group, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_USER_MGMT, "add-user-to-group", @@ -514,9 +508,8 @@ static void log_gpasswd_success (const char *suffix) SHADOW_AUDIT_SUCCESS); #endif } else if (dflg) { - SYSLOG ((LOG_INFO, - "user %s removed by %s from group %s%s", - user, myname, group, suffix)); + SYSLOG(LOG_INFO, "user %s removed by %s from group %s%s", + user, myname, group, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_USER_MGMT, "delete-user-from-group", @@ -524,9 +517,8 @@ static void log_gpasswd_success (const char *suffix) SHADOW_AUDIT_SUCCESS); #endif } else if (rflg) { - SYSLOG ((LOG_INFO, - "password of group %s removed by %s%s", - group, myname, suffix)); + SYSLOG(LOG_INFO, "password of group %s removed by %s%s", + group, myname, suffix); #ifdef WITH_AUDIT stprintf_a(buf, "password of group %s removed by %s%s", group, myname, suffix); @@ -536,9 +528,8 @@ static void log_gpasswd_success (const char *suffix) SHADOW_AUDIT_SUCCESS); #endif } else if (Rflg) { - SYSLOG ((LOG_INFO, - "access to group %s restricted by %s%s", - group, myname, suffix)); + SYSLOG(LOG_INFO, "access to group %s restricted by %s%s", + group, myname, suffix); #ifdef WITH_AUDIT stprintf_a(buf, "access to group %s restricted by %s%s", group, myname, suffix); @@ -550,9 +541,8 @@ static void log_gpasswd_success (const char *suffix) } else if (Aflg || Mflg) { #ifdef SHADOWGRP if (Aflg) { - SYSLOG ((LOG_INFO, - "administrators of group %s set by %s to %s%s", - group, myname, admins, suffix)); + SYSLOG(LOG_INFO, "administrators of group %s set by %s to %s%s", + group, myname, admins, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_GRP_MGMT, "set-admins-of-group", @@ -562,9 +552,8 @@ static void log_gpasswd_success (const char *suffix) } #endif /* SHADOWGRP */ if (Mflg) { - SYSLOG ((LOG_INFO, - "members of group %s set by %s to %s%s", - group, myname, members, suffix)); + SYSLOG(LOG_INFO, "members of group %s set by %s to %s%s", + group, myname, members, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_USER_MGMT, "add-users-to-group", @@ -573,9 +562,8 @@ static void log_gpasswd_success (const char *suffix) #endif } } else { - SYSLOG ((LOG_INFO, - "password of group %s changed by %s%s", - group, myname, suffix)); + SYSLOG(LOG_INFO, "password of group %s changed by %s%s", + group, myname, suffix); #ifdef WITH_AUDIT audit_logger_with_group (AUDIT_GRP_CHAUTHTOK, "change-password", @@ -730,7 +718,7 @@ static void get_group(struct group *gr, const struct option_flags *flags) if (gr_open (O_RDONLY) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", gr_dbname()); exit (E_NOPERM); } @@ -751,9 +739,7 @@ static void get_group(struct group *gr, const struct option_flags *flags) fprintf (stderr, _("%s: failure while closing read-only %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, - "failure while closing read-only %s", - gr_dbname ())); + SYSLOG(LOG_ERR, "failure while closing read-only %s", gr_dbname()); exit (E_NOPERM); } @@ -763,7 +749,7 @@ static void get_group(struct group *gr, const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", sgr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", sgr_dbname()); exit (E_NOPERM); } tmpsg = sgr_locate (group); @@ -789,9 +775,8 @@ static void get_group(struct group *gr, const struct option_flags *flags) fprintf (stderr, _("%s: failure while closing read-only %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, - "failure while closing read-only %s", - sgr_dbname ())); + SYSLOG(LOG_ERR, "failure while closing read-only %s", + sgr_dbname()); exit (E_NOPERM); } } @@ -931,9 +916,9 @@ int main (int argc, char **argv) if (NULL == pw) { fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - SYSLOG ((LOG_WARN, - "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) getuid ())); + SYSLOG(LOG_WARN, + "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) getuid()); exit (E_NOPERM); } myname = xstrdup (pw->pw_name); @@ -1105,7 +1090,7 @@ int main (int argc, char **argv) output: if (setuid (0) != 0) { fputs (_("Cannot change ID to root.\n"), stderr); - SYSLOG ((LOG_ERR, "can't setuid(0)")); + SYSLOG(LOG_ERR, "can't setuid(0)"); closelog (); exit (E_NOPERM); } diff --git a/src/groupadd.c b/src/groupadd.c index 4d84bb678..a2a13f066 100644 --- a/src/groupadd.c +++ b/src/groupadd.c @@ -294,8 +294,8 @@ static void close_files(const struct option_flags *flags) "add-group", group_name, group_id, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, "group added to %s: name=%s, GID=%u", - gr_dbname (), group_name, (unsigned int) group_id)); + SYSLOG(LOG_INFO, "group added to %s: name=%s, GID=%u", + gr_dbname(), group_name, (unsigned int) group_id); del_cleanup (cleanup_report_add_group_group); cleanup_unlock_group (&process_selinux); @@ -315,8 +315,8 @@ static void close_files(const struct option_flags *flags) "add-shadow-group", group_name, group_id, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, "group added to %s: name=%s", - sgr_dbname (), group_name)); + SYSLOG(LOG_INFO, "group added to %s: name=%s", + sgr_dbname(), group_name); del_cleanup (cleanup_report_add_group_gshadow); cleanup_unlock_gshadow (&process_selinux); @@ -325,8 +325,8 @@ static void close_files(const struct option_flags *flags) #endif /* SHADOWGRP */ /* Report success at the system level */ - SYSLOG ((LOG_INFO, "new group: name=%s, GID=%u", - group_name, (unsigned int) group_id)); + SYSLOG(LOG_INFO, "new group: name=%s, GID=%u", + group_name, (unsigned int) group_id); del_cleanup (cleanup_report_add_group); } @@ -371,7 +371,7 @@ static void open_files(const struct option_flags *flags) /* And now open the databases */ if (gr_open (O_CREAT | O_RDWR) == 0) { fprintf(stderr, _("%s: cannot open %s: %s\n"), Prog, gr_dbname(), strerrno()); - SYSLOG((LOG_WARN, "cannot open %s: %s", gr_dbname(), strerrno())); + SYSLOG(LOG_WARN, "cannot open %s: %s", gr_dbname(), strerrno()); fail_exit (E_GRP_UPDATE); } @@ -381,7 +381,7 @@ static void open_files(const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s: %s\n"), Prog, sgr_dbname(), strerrno()); - SYSLOG((LOG_WARN, "cannot open %s: %s", sgr_dbname(), strerrno())); + SYSLOG(LOG_WARN, "cannot open %s: %s", sgr_dbname(), strerrno()); fail_exit (E_GRP_UPDATE); } } diff --git a/src/groupdel.c b/src/groupdel.c index 47a080d5e..0df511719 100644 --- a/src/groupdel.c +++ b/src/groupdel.c @@ -166,9 +166,7 @@ static void close_files(const struct option_flags *flags) "delete-group", group_name, group_id, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "group '%s' removed from %s", - group_name, gr_dbname ())); + SYSLOG(LOG_INFO, "group '%s' removed from %s", group_name, gr_dbname()); del_cleanup (cleanup_report_del_group_group); cleanup_unlock_group (&process_selinux); @@ -190,9 +188,7 @@ static void close_files(const struct option_flags *flags) "delete-shadow-group", group_name, group_id, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "group '%s' removed from %s", - group_name, sgr_dbname ())); + SYSLOG(LOG_INFO, "group '%s' removed from %s", group_name, sgr_dbname()); del_cleanup (cleanup_report_del_group_gshadow); cleanup_unlock_gshadow (&process_selinux); @@ -200,7 +196,7 @@ static void close_files(const struct option_flags *flags) } #endif /* SHADOWGRP */ - SYSLOG ((LOG_INFO, "group '%s' removed\n", group_name)); + SYSLOG(LOG_INFO, "group '%s' removed\n", group_name); del_cleanup (cleanup_report_del_group); } @@ -246,7 +242,7 @@ static void open_files(const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", gr_dbname()); fail_exit (E_GRP_UPDATE); } #ifdef SHADOWGRP @@ -255,7 +251,7 @@ static void open_files(const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", sgr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", sgr_dbname()); fail_exit (E_GRP_UPDATE); } } diff --git a/src/groupmems.c b/src/groupmems.c index d8fd42441..88054bb70 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -458,7 +458,7 @@ check_perms(MAYBE_UNUSED bool process_selinux) if (PAM_SUCCESS != retval) { fprintf (stderr, _("%s: PAM: %s\n"), Prog, pam_strerror (pamh, retval)); - SYSLOG((LOG_ERR, "%s", pam_strerror (pamh, retval))); + SYSLOG(LOG_ERR, "%s", pam_strerror(pamh, retval)); if (NULL != pamh) { (void) pam_end (pamh, retval); } @@ -476,7 +476,7 @@ static void fail_exit (int code, bool process_selinux) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -487,7 +487,7 @@ static void fail_exit (int code, bool process_selinux) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -543,13 +543,13 @@ static void close_files(const struct option_flags *flags) if ((gr_close (process_selinux) == 0) && !list) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", gr_dbname()); fail_exit (EXIT_GROUP_FILE, process_selinux); } if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } gr_locked = false; @@ -559,13 +559,13 @@ static void close_files(const struct option_flags *flags) if (is_shadowgrp) { if ((sgr_close (process_selinux) == 0) && !list) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sgr_dbname()); fail_exit (EXIT_GROUP_FILE, process_selinux); } if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } sgr_locked = false; diff --git a/src/groupmod.c b/src/groupmod.c index ce265c8e4..b019c0103 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -501,9 +501,7 @@ static void close_files(const struct option_flags *flags) group_name, AUDIT_NO_ID, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "group changed in %s (%s)", - gr_dbname (), info_group.action)); + SYSLOG(LOG_INFO, "group changed in %s (%s)", gr_dbname(), info_group.action); del_cleanup (cleanup_report_mod_group); cleanup_unlock_group (&process_selinux); @@ -531,9 +529,8 @@ static void close_files(const struct option_flags *flags) group_name, AUDIT_NO_ID, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "group changed in %s (%s)", - sgr_dbname (), info_gshadow.action)); + SYSLOG(LOG_INFO, "group changed in %s (%s)", + sgr_dbname(), info_gshadow.action); del_cleanup (cleanup_report_mod_gshadow); cleanup_unlock_gshadow (&process_selinux); @@ -554,9 +551,8 @@ static void close_files(const struct option_flags *flags) group_name, AUDIT_NO_ID, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "group changed in %s (%s)", - pw_dbname (), info_passwd.action)); + SYSLOG(LOG_INFO, "group changed in %s (%s)", + pw_dbname(), info_passwd.action); del_cleanup (cleanup_report_mod_passwd); cleanup_unlock_passwd (&process_selinux); @@ -713,7 +709,7 @@ static void open_files (void) { if (gr_open (O_CREAT | O_RDWR) == 0) { fprintf (stderr, _("%s: cannot open %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", gr_dbname()); exit (E_GRP_UPDATE); } @@ -724,7 +720,7 @@ static void open_files (void) fprintf (stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", sgr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", sgr_dbname()); exit (E_GRP_UPDATE); } } @@ -735,7 +731,7 @@ static void open_files (void) fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", gr_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", gr_dbname()); exit (E_GRP_UPDATE); } } diff --git a/src/grpck.c b/src/grpck.c index 90c724c9b..385c105e8 100644 --- a/src/grpck.c +++ b/src/grpck.c @@ -106,7 +106,7 @@ static void fail_exit (int status, bool process_selinux) if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -115,7 +115,7 @@ static void fail_exit (int status, bool process_selinux) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -304,7 +304,7 @@ static void open_files (bool process_selinux) fprintf (stderr, _("%s: cannot open %s\n"), Prog, grp_file); if (use_system_grp_file) { - SYSLOG ((LOG_WARN, "cannot open %s", grp_file)); + SYSLOG(LOG_WARN, "cannot open %s", grp_file); } fail_exit (E_CANT_OPEN, process_selinux); } @@ -313,7 +313,7 @@ static void open_files (bool process_selinux) fprintf (stderr, _("%s: cannot open %s\n"), Prog, sgr_file); if (use_system_sgr_file) { - SYSLOG ((LOG_WARN, "cannot open %s", sgr_file)); + SYSLOG(LOG_WARN, "cannot open %s", sgr_file); } fail_exit (E_CANT_OPEN, process_selinux); } @@ -359,7 +359,7 @@ static void close_files(bool changed, const struct option_flags *flags) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } sgr_locked = false; @@ -368,7 +368,7 @@ static void close_files(bool changed, const struct option_flags *flags) if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } gr_locked = false; @@ -424,7 +424,7 @@ static int check_members (const char *groupname, continue; } - SYSLOG ((LOG_INFO, fmt_syslog, members[i], groupname)); + SYSLOG(LOG_INFO, fmt_syslog, members[i], groupname); members_changed = 1; delete_member (members, members[i]); @@ -524,8 +524,7 @@ static void check_grp_file(bool *errors, bool *changed, const struct option_flag * to try out the next list element. */ delete_gr: - SYSLOG ((LOG_INFO, "delete group line '%s'", - gre->line)); + SYSLOG(LOG_INFO, "delete group line '%s'", gre->line); *changed = true; __gr_del_entry (gre); @@ -638,9 +637,8 @@ static void check_grp_file(bool *errors, bool *changed, const struct option_flag sg.sg_passwd = grp->gr_passwd; sg.sg_adm = ∅ sg.sg_mem = grp->gr_mem; - SYSLOG ((LOG_INFO, - "add group '%s' to '%s'", - grp->gr_name, sgr_file)); + SYSLOG(LOG_INFO, "add group '%s' to '%s'", + grp->gr_name, sgr_file); *changed = true; if (sgr_update (&sg) == 0) { @@ -727,8 +725,7 @@ static void check_sgr_file (bool *errors, bool *changed) * of the loop to try out the next list element. */ delete_sg: - SYSLOG ((LOG_INFO, "delete shadow line '%s'", - sge->line)); + SYSLOG(LOG_INFO, "delete shadow line '%s'", sge->line); *changed = true; __sgr_del_entry (sge); diff --git a/src/grpconv.c b/src/grpconv.c index 4a0c308d4..a41a1a842 100644 --- a/src/grpconv.c +++ b/src/grpconv.c @@ -65,7 +65,7 @@ static void fail_exit (int status, bool process_selinux) if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -73,7 +73,7 @@ static void fail_exit (int status, bool process_selinux) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -249,24 +249,24 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sgr_dbname()); fail_exit (3, process_selinux); } if (gr_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", gr_dbname()); fail_exit (3, process_selinux); } if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } diff --git a/src/grpunconv.c b/src/grpunconv.c index 5e76ede06..cf5fa1bc9 100644 --- a/src/grpunconv.c +++ b/src/grpunconv.c @@ -64,7 +64,7 @@ static void fail_exit (int status, bool process_selinux) if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -72,7 +72,7 @@ static void fail_exit (int status, bool process_selinux) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -208,7 +208,7 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", gr_dbname()); fail_exit (3, process_selinux); } @@ -216,19 +216,19 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: cannot delete %s\n"), Prog, _PATH_GSHADOW); - SYSLOG((LOG_ERR, "cannot delete %s", _PATH_GSHADOW)); + SYSLOG(LOG_ERR, "cannot delete %s", _PATH_GSHADOW); fail_exit (3, process_selinux); } if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } diff --git a/src/login.c b/src/login.c index f5543796f..57cd0fb69 100644 --- a/src/login.c +++ b/src/login.c @@ -57,7 +57,7 @@ static pam_handle_t *pamh = NULL; #define PAM_FAIL_CHECK if (retcode != PAM_SUCCESS) { \ fprintf(stderr,"\n%s\n",pam_strerror(pamh, retcode)); \ - SYSLOG((LOG_ERR,"%s",pam_strerror(pamh, retcode))); \ + SYSLOG(LOG_ERR,"%s",pam_strerror(pamh, retcode)); \ (void) pam_end(pamh, retcode); \ exit(1); \ } @@ -509,9 +509,9 @@ int main (int argc, char **argv) * root), but not if run by root. */ if (!amroot && (err != 0)) { - SYSLOG ((LOG_ERR, - "No session entry, error %d. You must exec \"login\" from the lowest level \"sh\"", - err)); + SYSLOG(LOG_ERR, + "No session entry, error %d. You must exec \"login\" from the lowest level \"sh\"", + err); exit (1); } @@ -617,8 +617,7 @@ int main (int argc, char **argv) fprintf (stderr, _("login: PAM Failure, aborting: %s\n"), pam_strerror (pamh, retcode)); - SYSLOG ((LOG_ERR, "Couldn't initialize PAM: %s", - pam_strerror (pamh, retcode))); + SYSLOG(LOG_ERR, "Couldn't initialize PAM: %s", pam_strerror(pamh, retcode)); exit (99); } @@ -688,9 +687,9 @@ int main (int argc, char **argv) failent_user = get_failent_user (pam_user); if (retcode == PAM_MAXTRIES) { - SYSLOG ((LOG_NOTICE, - "TOO MANY LOGIN TRIES (%u)%s FOR '%s'", - failcount, fromhost, failent_user)); + SYSLOG(LOG_NOTICE, + "TOO MANY LOGIN TRIES (%u)%s FOR '%s'", + failcount, fromhost, failent_user); fprintf (stderr, _("Maximum number of tries exceeded (%u)\n"), failcount); @@ -699,13 +698,13 @@ int main (int argc, char **argv) } else if (retcode == PAM_ABORT) { /* Serious problems, quit now */ (void) fputs (_("login: abort requested by PAM\n"), stderr); - SYSLOG ((LOG_ERR,"PAM_ABORT returned from pam_authenticate()")); + SYSLOG(LOG_ERR, "PAM_ABORT returned from pam_authenticate()"); PAM_END; exit(99); } else if (retcode != PAM_SUCCESS) { - SYSLOG ((LOG_NOTICE,"FAILED LOGIN (%u)%s FOR '%s', %s", + SYSLOG(LOG_NOTICE, "FAILED LOGIN (%u)%s FOR '%s', %s", failcount, fromhost, failent_user, - pam_strerror (pamh, retcode))); + pam_strerror(pamh, retcode)); failed = true; } @@ -732,9 +731,9 @@ int main (int argc, char **argv) (void) puts (_("Login incorrect")); if (failcount >= retries) { - SYSLOG ((LOG_NOTICE, - "TOO MANY LOGIN TRIES (%u)%s FOR '%s'", - failcount, fromhost, failent_user)); + SYSLOG(LOG_NOTICE, + "TOO MANY LOGIN TRIES (%u)%s FOR '%s'", + failcount, fromhost, failent_user); fprintf (stderr, _("Maximum number of tries exceeded (%u)\n"), failcount); @@ -780,7 +779,7 @@ int main (int argc, char **argv) pwd = xgetpwnam (username); if (NULL == pwd) { - SYSLOG ((LOG_ERR, "cannot find user %s", failent_user)); + SYSLOG(LOG_ERR, "cannot find user %s", failent_user); fprintf (stderr, _("Cannot find user (%s)\n"), username); @@ -885,9 +884,8 @@ int main (int argc, char **argv) * shadow. SHADOW_PASSWD_STRING indicates * that the password shall be in shadow. */ - SYSLOG ((LOG_WARN, - "no shadow password for '%s'%s", - username, fromhost)); + SYSLOG(LOG_WARN, "no shadow password for '%s'%s", + username, fromhost); } } @@ -903,8 +901,8 @@ int main (int argc, char **argv) goto auth_ok; } - SYSLOG ((LOG_WARN, "invalid password for '%s' %s", - failent_user, fromhost)); + SYSLOG(LOG_WARN, "invalid password for '%s' %s", + failent_user, fromhost); failed = true; auth_ok: @@ -917,21 +915,20 @@ int main (int argc, char **argv) && (NULL != pwd) && (0 == pwd->pw_uid) && !is_console) { - SYSLOG ((LOG_CRIT, "ILLEGAL ROOT LOGIN %s", fromhost)); + SYSLOG(LOG_CRIT, "ILLEGAL ROOT LOGIN %s", fromhost); failed = true; } if ( !failed && !login_access(username, (!streq(hostname, "")) ? hostname : tty)) { - SYSLOG ((LOG_WARN, "LOGIN '%s' REFUSED %s", - username, fromhost)); + SYSLOG(LOG_WARN, "LOGIN '%s' REFUSED %s", + username, fromhost); failed = true; } if ( (NULL != pwd) && getdef_bool ("FAILLOG_ENAB") && !failcheck (pwd->pw_uid, &faillog, failed)) { - SYSLOG ((LOG_CRIT, - "exceeded failure limit for '%s' %s", - username, fromhost)); + SYSLOG(LOG_CRIT, "exceeded failure limit for '%s' %s", + username, fromhost); failed = true; } if (!failed) { @@ -948,8 +945,7 @@ int main (int argc, char **argv) retries--; if (retries <= 0) { - SYSLOG ((LOG_CRIT, "REPEATED login failures%s", - fromhost)); + SYSLOG(LOG_CRIT, "REPEATED login failures%s", fromhost); } /* @@ -1001,8 +997,8 @@ int main (int argc, char **argv) */ if ( getdef_bool ("PORTTIME_CHECKS_ENAB") && !isttytime (username, tty, time (NULL))) { - SYSLOG ((LOG_WARN, "invalid login time for '%s'%s", - username, fromhost)); + SYSLOG(LOG_WARN, "invalid login time for '%s'%s", + username, fromhost); closelog (); bad_time_notify (); exit (1); @@ -1069,9 +1065,9 @@ int main (int argc, char **argv) pw_free (pwd); pwd = xgetpwnam (username); if (NULL == pwd) { - SYSLOG ((LOG_ERR, - "cannot find user %s after update of expired password", - username)); + SYSLOG(LOG_ERR, + "cannot find user %s after update of expired password", + username); exit (1); } spw_free (spwd); @@ -1121,7 +1117,7 @@ int main (int argc, char **argv) */ err = update_utmp(username, tty, hostname, initial_pid); if (err != 0) { - SYSLOG ((LOG_WARN, "Unable to update utmp entry for %s", username)); + SYSLOG(LOG_WARN, "Unable to update utmp entry for %s", username); } #endif /* ENABLE_LOGIND */ @@ -1185,9 +1181,9 @@ int main (int argc, char **argv) if ( (0 != faillog.fail_max) && (faillog.fail_cnt >= faillog.fail_max)) { (void) puts (_("Warning: login re-enabled after temporary lockout.")); - SYSLOG ((LOG_WARN, - "login '%s' re-enabled after temporary lockout (%d failures)", - username, (int) faillog.fail_cnt)); + SYSLOG(LOG_WARN, + "login '%s' re-enabled after temporary lockout (%d failures)", + username, (int) faillog.fail_cnt); } } #ifdef ENABLE_LASTLOG @@ -1228,9 +1224,9 @@ int main (int argc, char **argv) (void) signal (SIGINT, SIG_DFL); /* default interrupt signal */ if (0 == pwd->pw_uid) { - SYSLOG ((LOG_NOTICE, "ROOT LOGIN %s", fromhost)); + SYSLOG(LOG_NOTICE, "ROOT LOGIN %s", fromhost); } else if (getdef_bool ("LOG_OK_LOGINS")) { - SYSLOG ((LOG_INFO, "'%s' logged in %s", username, fromhost)); + SYSLOG(LOG_INFO, "'%s' logged in %s", username, fromhost); } closelog (); tmp = getdef_str ("FAKE_SHELL"); diff --git a/src/login_nopam.c b/src/login_nopam.c index a41a3f0bd..08702fa49 100644 --- a/src/login_nopam.c +++ b/src/login_nopam.c @@ -106,9 +106,9 @@ login_access(const char *user, const char *from) lineno++; if (stpsep(line, "\n") == NULL) { - SYSLOG ((LOG_ERR, - "%s: line %jd: missing newline or line too long", - TABLE, lineno)); + SYSLOG(LOG_ERR, + "%s: line %jd: missing newline or line too long", + TABLE, lineno); continue; } if (strprefix(line, "#")) { @@ -123,15 +123,13 @@ login_access(const char *user, const char *from) users = strsep(&p, ":"); froms = strsep(&p, ":"); if (froms == NULL || p != NULL) { - SYSLOG ((LOG_ERR, - "%s: line %jd: bad field count", - TABLE, lineno)); + SYSLOG(LOG_ERR, "%s: line %jd: bad field count", + TABLE, lineno); continue; } if (perm[0] != '+' && perm[0] != '-') { - SYSLOG ((LOG_ERR, - "%s: line %jd: bad first field", - TABLE, lineno)); + SYSLOG(LOG_ERR, "%s: line %jd: bad first field", + TABLE, lineno); continue; } match = ( list_match (froms, from, from_match) @@ -140,7 +138,7 @@ login_access(const char *user, const char *from) (void) fclose (fp); } else if (errno != ENOENT) { int err = errno; - SYSLOG ((LOG_ERR, "cannot open %s: %s", TABLE, strerror (err))); + SYSLOG(LOG_ERR, "cannot open %s: %s", TABLE, strerror(err)); } return (!match || strprefix(line, "+"))?1:0; } @@ -270,7 +268,7 @@ static const char *resolve_hostname (const char *string) gai_err = getaddrinfo(string, NULL, NULL, &addrs); if (gai_err != 0) { - SYSLOG ((LOG_ERR, "getaddrinfo(%s): %s", string, gai_strerror(gai_err))); + SYSLOG(LOG_ERR, "getaddrinfo(%s): %s", string, gai_strerror(gai_err)); return string; } @@ -278,7 +276,7 @@ static const char *resolve_hostname (const char *string) gai_err = getnameinfo(addrs[0].ai_addr, addrs[0].ai_addrlen, host, countof(host), NULL, 0, NI_NUMERICHOST); if (gai_err != 0) { - SYSLOG ((LOG_ERR, "getnameinfo(%s): %s", string, gai_strerror(gai_err))); + SYSLOG(LOG_ERR, "getnameinfo(%s): %s", string, gai_strerror(gai_err)); addr_str = string; } diff --git a/src/newgidmap.c b/src/newgidmap.c index 9d130a7d3..afda66657 100644 --- a/src/newgidmap.c +++ b/src/newgidmap.c @@ -182,8 +182,8 @@ int main(int argc, char **argv) fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) getuid ())); + SYSLOG(LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) getuid()); return EXIT_FAILURE; } diff --git a/src/newgrp.c b/src/newgrp.c index 5c4cc07b1..d1ae7f2b2 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -190,9 +190,9 @@ static void check_perms (const struct group *grp, fprintf (stderr, _("%s: failed to crypt password with previous salt: %s\n"), Prog, strerrno()); - SYSLOG ((LOG_INFO, - "Failed to crypt password with previous salt of group '%s'", - groupname)); + SYSLOG(LOG_INFO, + "Failed to crypt password with previous salt of group '%s'", + groupname); goto failure; } @@ -204,9 +204,9 @@ static void check_perms (const struct group *grp, audit_logger (AUDIT_GRP_AUTH, audit_buf, NULL, getuid (), SHADOW_AUDIT_FAILURE); #endif - SYSLOG ((LOG_INFO, - "Invalid password for group '%s' from '%s'", - groupname, pwd->pw_name)); + SYSLOG(LOG_INFO, + "Invalid password for group '%s' from '%s'", + groupname, pwd->pw_name); (void) sleep (1); (void) fputs (_("Invalid password.\n"), stderr); goto failure; @@ -258,9 +258,8 @@ static void syslog_sg (const char *name, const char *group) } tty = strprefix(tty, "/dev/") ?: tty; - SYSLOG ((LOG_INFO, - "user '%s' (login '%s' on %s) switched to group '%s'", - name, loginname, tty, group)); + SYSLOG(LOG_INFO, "user '%s' (login '%s' on %s) switched to group '%s'", + name, loginname, tty, group); #ifdef USE_PAM /* * We want to fork and exec the new shell in the child, leaving the @@ -330,21 +329,20 @@ static void syslog_sg (const char *name, const char *group) || ((pid != child) && (errno == EINTR))); /* local, no need for xgetgrgid */ if (NULL != grp) { - SYSLOG ((LOG_INFO, - "user '%s' (login '%s' on %s) returned to group '%s'", - name, loginname, tty, grp->gr_name)); + SYSLOG(LOG_INFO, + "user '%s' (login '%s' on %s) returned to group '%s'", + name, loginname, tty, grp->gr_name); } else { - SYSLOG ((LOG_INFO, - "user '%s' (login '%s' on %s) returned to group '%lu'", - name, loginname, tty, - (unsigned long) gid)); + SYSLOG(LOG_INFO, + "user '%s' (login '%s' on %s) returned to group '%lu'", + name, loginname, tty, (unsigned long) gid); /* Either the user's passwd entry has a * GID that does not match with any group, * or the group was deleted while the user * was in a newgrp session.*/ - SYSLOG ((LOG_WARN, - "unknown GID '%lu' used by user '%s'", - (unsigned long) gid, name)); + SYSLOG(LOG_WARN, + "unknown GID '%lu' used by user '%s'", + (unsigned long) gid, name); } closelog (); exit ((0 != WIFEXITED (cst)) ? WEXITSTATUS (cst) @@ -444,8 +442,8 @@ int main (int argc, char **argv) audit_logger (AUDIT_CHGRP_ID, "changing", NULL, getuid (), SHADOW_AUDIT_FAILURE); #endif - SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) getuid ())); + SYSLOG(LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) getuid()); closelog (); exit (EXIT_FAILURE); } @@ -537,8 +535,8 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: GID '%lu' does not exist\n"), Prog, (unsigned long) pwd->pw_gid); - SYSLOG ((LOG_CRIT, "GID '%lu' does not exist", - (unsigned long) pwd->pw_gid)); + SYSLOG(LOG_CRIT, "GID '%lu' does not exist", + (unsigned long) pwd->pw_gid); goto failure; } else { group = grp->gr_name; diff --git a/src/newuidmap.c b/src/newuidmap.c index 43826b1d0..108852eae 100644 --- a/src/newuidmap.c +++ b/src/newuidmap.c @@ -116,8 +116,8 @@ int main(int argc, char **argv) fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) getuid ())); + SYSLOG(LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) getuid()); return EXIT_FAILURE; } diff --git a/src/newusers.c b/src/newusers.c index 853218fd3..1f58b7753 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -160,21 +160,21 @@ static void fail_exit (int code, bool process_selinux) if (spw_locked) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -182,7 +182,7 @@ static void fail_exit (int code, bool process_selinux) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -191,14 +191,14 @@ static void fail_exit (int code, bool process_selinux) if (sub_uid_locked) { if (sub_uid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); /* continue */ } } if (sub_gid_locked) { if (sub_gid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); /* continue */ } } @@ -869,12 +869,12 @@ static void close_files(const struct option_flags *flags) if (pw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (EXIT_FAILURE, process_selinux); } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } pw_locked = false; @@ -884,14 +884,14 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (EXIT_FAILURE, process_selinux); } if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } spw_locked = false; @@ -901,20 +901,20 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", gr_dbname()); fail_exit (EXIT_FAILURE, process_selinux); } #ifdef ENABLE_SUBIDS if (is_sub_uid && (sub_uid_close (process_selinux) == 0)) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_uid_dbname()); fail_exit (EXIT_FAILURE, process_selinux); } if (is_sub_gid && (sub_gid_close (process_selinux) == 0)) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_gid_dbname()); fail_exit (EXIT_FAILURE, process_selinux); } #endif /* ENABLE_SUBIDS */ @@ -923,7 +923,7 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } gr_locked = false; @@ -934,14 +934,14 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sgr_dbname()); fail_exit (EXIT_FAILURE, process_selinux); } if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } sgr_locked = false; @@ -951,7 +951,7 @@ static void close_files(const struct option_flags *flags) if (is_sub_uid) { if (sub_uid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); /* continue */ } sub_uid_locked = false; @@ -959,7 +959,7 @@ static void close_files(const struct option_flags *flags) if (is_sub_gid) { if (sub_gid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); /* continue */ } sub_gid_locked = false; diff --git a/src/passwd.c b/src/passwd.c index 103393382..6fd2366e9 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -214,17 +214,16 @@ static int new_password (const struct passwd *pw) fprintf (stderr, _("%s: failed to crypt password with previous salt: %s\n"), Prog, strerrno()); - SYSLOG ((LOG_INFO, - "Failed to crypt password with previous salt of user '%s'", - pw->pw_name)); + SYSLOG(LOG_INFO, + "Failed to crypt password with previous salt of user '%s'", + pw->pw_name); return -1; } if (!streq(cipher, crypt_passwd)) { erase_pass (clear); strzero (cipher); - SYSLOG ((LOG_WARN, "incorrect password for %s", - pw->pw_name)); + SYSLOG(LOG_WARN, "incorrect password for %s", pw->pw_name); (void) sleep (1); (void) fprintf (stderr, _("Incorrect password for %s.\n"), @@ -394,7 +393,7 @@ static void check_password (const struct passwd *pw, const struct spwd *sp, bool (void) fprintf (stderr, _("The password for %s cannot be changed.\n"), sp->sp_namp); - SYSLOG ((LOG_WARN, "password locked for '%s'", sp->sp_namp)); + SYSLOG(LOG_WARN, "password locked for '%s'", sp->sp_namp); closelog (); fail_exit(E_NOPERM, process_selinux); } @@ -415,7 +414,7 @@ static void check_password (const struct passwd *pw, const struct spwd *sp, bool (void) fprintf (stderr, _("The password for %s cannot be changed yet.\n"), sp->sp_namp); - SYSLOG ((LOG_WARN, "now < minimum age for '%s'", sp->sp_namp)); + SYSLOG(LOG_WARN, "now < minimum age for '%s'", sp->sp_namp); closelog (); fail_exit(E_NOPERM, process_selinux); } @@ -469,7 +468,7 @@ fail_exit (int status, bool process_selinux) if (spw_locked) { if (spw_unlock (process_selinux) == 0) { (void) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } @@ -477,7 +476,7 @@ fail_exit (int status, bool process_selinux) if (pw_locked) { if (pw_unlock (process_selinux) == 0) { (void) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -511,7 +510,7 @@ static void open_files(bool process_selinux) (void) fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", pw_dbname()); fail_exit (E_MISSING, process_selinux); } @@ -528,7 +527,7 @@ static void open_files(bool process_selinux) (void) fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_WARN, "cannot open %s", spw_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", spw_dbname()); fail_exit (E_FAILURE, process_selinux); } } @@ -546,14 +545,14 @@ static void close_files(bool process_selinux) (void) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (E_FAILURE, process_selinux); } if (spw_unlock (process_selinux) == 0) { (void) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } spw_locked = false; @@ -562,14 +561,14 @@ static void close_files(bool process_selinux) (void) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (E_FAILURE, process_selinux); } if (pw_unlock (process_selinux) == 0) { (void) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } pw_locked = false; @@ -988,8 +987,8 @@ main(int argc, char **argv) (void) fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) getuid ())); + SYSLOG(LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) getuid()); exit (E_NOPERM); } myname = xstrdup (pw->pw_name); @@ -1088,9 +1087,9 @@ main(int argc, char **argv) NULL, pw->pw_uid, SHADOW_AUDIT_FAILURE); #endif /* WITH_AUDIT */ - SYSLOG ((LOG_ALERT, - "root is not authorized by SELinux to change the password of %s", - name)); + SYSLOG(LOG_ALERT, + "root is not authorized by SELinux to change the password of %s", + name); (void) fprintf(stderr, _("%s: root is not authorized by SELinux to change the password of %s\n"), Prog, name); @@ -1112,9 +1111,9 @@ main(int argc, char **argv) (void) fprintf (stderr, _("%s: You may not view or modify password information for %s.\n"), Prog, name); - SYSLOG ((LOG_WARN, - "can't view or modify password information for %s", - name)); + SYSLOG(LOG_WARN, + "can't view or modify password information for %s", + name); closelog (); exit (E_NOPERM); } @@ -1200,7 +1199,7 @@ main(int argc, char **argv) #endif /* USE_PAM */ if (setuid (0) != 0) { (void) fputs (_("Cannot change ID to root.\n"), stderr); - SYSLOG ((LOG_ERR, "can't setuid(0)")); + SYSLOG(LOG_ERR, "can't setuid(0)"); closelog (); exit (E_NOPERM); } @@ -1212,7 +1211,7 @@ main(int argc, char **argv) nscd_flush_cache ("group"); sssd_flush_cache (SSSD_DB_PASSWD | SSSD_DB_GROUP); - SYSLOG ((LOG_INFO, "password for '%s' changed by '%s'", name, myname)); + SYSLOG(LOG_INFO, "password for '%s' changed by '%s'", name, myname); closelog (); if (!qflg) { if (!anyflag) { diff --git a/src/pwck.c b/src/pwck.c index c35f03e69..9d980dd5f 100644 --- a/src/pwck.c +++ b/src/pwck.c @@ -93,8 +93,7 @@ static void fail_exit (int code, bool process_selinux) if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { - SYSLOG ((LOG_ERR, "failed to unlock %s", - spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); } /* continue */ } @@ -104,8 +103,7 @@ static void fail_exit (int code, bool process_selinux) if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); if (use_system_pw_file) { - SYSLOG ((LOG_ERR, "failed to unlock %s", - pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); } /* continue */ } @@ -286,7 +284,7 @@ static void open_files(const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s\n"), Prog, pw_dbname ()); if (use_system_pw_file) { - SYSLOG ((LOG_WARN, "cannot open %s", pw_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", pw_dbname()); } fail_exit (E_CANTOPEN, process_selinux); } @@ -295,8 +293,7 @@ static void open_files(const struct option_flags *flags) fprintf (stderr, _("%s: cannot open %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { - SYSLOG ((LOG_WARN, "cannot open %s", - spw_dbname ())); + SYSLOG(LOG_WARN, "cannot open %s", spw_dbname()); } fail_exit (E_CANTOPEN, process_selinux); } @@ -327,9 +324,9 @@ static void close_files(bool changed, const struct option_flags *flags) _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); if (use_system_pw_file) { - SYSLOG ((LOG_ERR, - "failure while writing changes to %s", - pw_dbname ())); + SYSLOG(LOG_ERR, + "failure while writing changes to %s", + pw_dbname()); } fail_exit (E_CANTUPDATE, process_selinux); } @@ -338,9 +335,9 @@ static void close_files(bool changed, const struct option_flags *flags) _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { - SYSLOG ((LOG_ERR, - "failure while writing changes to %s", - spw_dbname ())); + SYSLOG(LOG_ERR, + "failure while writing changes to %s", + spw_dbname()); } fail_exit (E_CANTUPDATE, process_selinux); } @@ -356,8 +353,7 @@ static void close_files(bool changed, const struct option_flags *flags) _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { - SYSLOG ((LOG_ERR, "failed to unlock %s", - spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); } /* continue */ } @@ -369,8 +365,7 @@ static void close_files(bool changed, const struct option_flags *flags) _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); if (use_system_pw_file) { - SYSLOG ((LOG_ERR, "failed to unlock %s", - pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); } /* continue */ } @@ -433,8 +428,8 @@ static void check_pw_file(bool *errors, bool *changed, const struct option_flags */ delete_pw: if (use_system_pw_file) { - SYSLOG ((LOG_INFO, "delete passwd line '%s'", - pfe->line)); + SYSLOG(LOG_INFO, "delete passwd line '%s'", + pfe->line); } *changed = true; @@ -602,9 +597,9 @@ static void check_pw_file(bool *errors, bool *changed, const struct option_flags _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { - SYSLOG ((LOG_ERR, - "failed to unlock %s", - spw_dbname ())); + SYSLOG(LOG_ERR, + "failed to unlock %s", + spw_dbname()); } } continue; @@ -678,9 +673,9 @@ static void check_pw_file(bool *errors, bool *changed, const struct option_flags _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { - SYSLOG ((LOG_ERR, - "failure while writing changes to %s", - spw_dbname ())); + SYSLOG(LOG_ERR, + "failure while writing changes to %s", + spw_dbname()); } } else { spw_opened = false; @@ -690,8 +685,8 @@ static void check_pw_file(bool *errors, bool *changed, const struct option_flags _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); if (use_system_spw_file) { - SYSLOG ((LOG_ERR, "failed to unlock %s", - spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", + spw_dbname()); } } else { spw_locked = false; @@ -758,8 +753,8 @@ static void check_spw_file (bool *errors, bool *changed) */ delete_spw: if (use_system_spw_file) { - SYSLOG ((LOG_INFO, "delete shadow line '%s'", - spe->line)); + SYSLOG(LOG_INFO, "delete shadow line '%s'", + spe->line); } *changed = true; diff --git a/src/pwconv.c b/src/pwconv.c index bbe38071f..5821d5a77 100644 --- a/src/pwconv.c +++ b/src/pwconv.c @@ -90,7 +90,7 @@ static void fail_exit (int status, bool process_selinux) if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -98,7 +98,7 @@ static void fail_exit (int status, bool process_selinux) if (spw_locked) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } @@ -287,14 +287,14 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (E_FAILURE, process_selinux); } if (pw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (E_FAILURE, process_selinux); } @@ -304,19 +304,19 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: failed to change the mode of %s to 0600\n"), Prog, PASSWD_FILE "-"); - SYSLOG ((LOG_ERR, "failed to change the mode of %s to 0600", PASSWD_FILE "-")); + SYSLOG(LOG_ERR, "failed to change the mode of %s to 0600", PASSWD_FILE "-"); /* continue */ } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } diff --git a/src/pwunconv.c b/src/pwunconv.c index 4adaf7028..a78417432 100644 --- a/src/pwunconv.c +++ b/src/pwunconv.c @@ -52,14 +52,14 @@ static void fail_exit (int status, bool process_selinux) if (spw_locked) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -208,25 +208,25 @@ int main (int argc, char **argv) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (3, process_selinux); } if (unlink (SHADOW) != 0) { fprintf (stderr, _("%s: cannot delete %s\n"), Prog, SHADOW); - SYSLOG ((LOG_ERR, "cannot delete %s", SHADOW)); + SYSLOG(LOG_ERR, "cannot delete %s", SHADOW); fail_exit (3, process_selinux); } if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } diff --git a/src/su.c b/src/su.c index dfbfc3c57..873af8ddf 100644 --- a/src/su.c +++ b/src/su.c @@ -204,10 +204,10 @@ su_failure (const char *tty, bool su_to_root) { sulog (tty, false, caller_name, name); /* log failed attempt */ if (getdef_bool ("SYSLOG_SU_ENAB")) { - SYSLOG ((su_to_root ? LOG_NOTICE : LOG_INFO, - "- %s %s:%s", tty, - ('\0' != caller_name[0]) ? caller_name : "???", - ('\0' != name[0]) ? name : "???")); + SYSLOG(su_to_root ? LOG_NOTICE : LOG_INFO, + "- %s %s:%s", tty, + ('\0' != caller_name[0]) ? caller_name : "???", + ('\0' != name[0]) ? name : "???"); } closelog (); @@ -296,7 +296,7 @@ static void prepare_pam_close_session (void) fprintf (stderr, _("%s: signal masking malfunction\n"), Prog); - SYSLOG ((LOG_WARN, "Will not execute %s", shellstr)); + SYSLOG(LOG_WARN, "Will not execute %s", shellstr); closelog (); exit (1); /* Only the child returns. See above. */ @@ -309,7 +309,7 @@ static void prepare_pam_close_session (void) (void) fprintf (stderr, _("%s: Cannot fork user shell\n"), Prog); - SYSLOG ((LOG_WARN, "Cannot execute %s", shellstr)); + SYSLOG(LOG_WARN, "Cannot execute %s", shellstr); closelog (); exit (1); /* Only the child returns. See above. */ @@ -428,8 +428,7 @@ static void prepare_pam_close_session (void) ret = pam_close_session (pamh, 0); if (PAM_SUCCESS != ret) { - SYSLOG ((LOG_ERR, "pam_close_session: %s", - pam_strerror (pamh, ret))); + SYSLOG(LOG_ERR, "pam_close_session: %s", pam_strerror(pamh, ret)); fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret)); } @@ -470,8 +469,8 @@ static void check_perms_pam (const struct passwd *pw) int ret; ret = pam_authenticate (pamh, 0); if (PAM_SUCCESS != ret) { - SYSLOG (((pw->pw_uid != 0)? LOG_NOTICE : LOG_WARN, "pam_authenticate: %s", - pam_strerror (pamh, ret))); + SYSLOG(pw->pw_uid ? LOG_NOTICE : LOG_WARN, "pam_authenticate: %s", + pam_strerror(pamh, ret)); fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret)); (void) pam_end (pamh, ret); su_failure (caller_tty, 0 == pw->pw_uid); @@ -486,8 +485,8 @@ static void check_perms_pam (const struct passwd *pw) } else if (PAM_NEW_AUTHTOK_REQD == ret) { ret = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK); if (PAM_SUCCESS != ret) { - SYSLOG ((LOG_ERR, "pam_chauthtok: %s", - pam_strerror (pamh, ret))); + SYSLOG(LOG_ERR, "pam_chauthtok: %s", + pam_strerror(pamh, ret)); fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret)); @@ -495,8 +494,7 @@ static void check_perms_pam (const struct passwd *pw) su_failure (caller_tty, 0 == pw->pw_uid); } } else { - SYSLOG ((LOG_ERR, "pam_acct_mgmt: %s", - pam_strerror (pamh, ret))); + SYSLOG(LOG_ERR, "pam_acct_mgmt: %s", pam_strerror(pamh, ret)); fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret)); @@ -595,8 +593,8 @@ static void check_perms_nopam (const struct passwd *pw) * character. */ if (pw_auth(password, name) != 0) { - SYSLOG (((pw->pw_uid != 0)? LOG_NOTICE : LOG_WARN, - "Authentication failed for %s", name)); + SYSLOG(pw->pw_uid ? LOG_NOTICE : LOG_WARN, + "Authentication failed for %s", name); fprintf(stderr, _("%s: Authentication failure\n"), Prog); su_failure (caller_tty, 0 == pw->pw_uid); } @@ -618,9 +616,8 @@ static void check_perms_nopam (const struct passwd *pw) * the account. */ if (!isttytime (name, "SU", time (NULL))) { - SYSLOG (((0 != pw->pw_uid) ? LOG_WARN : LOG_CRIT, - "SU by %s to restricted account %s", - caller_name, name)); + SYSLOG(pw->pw_uid ? LOG_WARN : LOG_CRIT, + "SU by %s to restricted account %s", caller_name, name); fprintf (stderr, _("%s: You are not authorized to su at that time\n"), Prog); @@ -665,7 +662,7 @@ static /*@only@*/struct passwd * do_check_perms (void) if (NULL == pw) { (void) fprintf (stderr, _("No passwd entry for user '%s'\n"), name); - SYSLOG ((LOG_NOTICE, "No passwd entry for user '%s'", name)); + SYSLOG(LOG_NOTICE, "No passwd entry for user '%s'", name); su_failure (caller_tty, true); } @@ -677,7 +674,7 @@ static /*@only@*/struct passwd * do_check_perms (void) /* PAM authentication can request a change of account */ ret = pam_get_item(pamh, PAM_USER, &item); if (ret != PAM_SUCCESS) { - SYSLOG((LOG_ERR, "pam_get_item: internal PAM error\n")); + SYSLOG(LOG_ERR, "pam_get_item: internal PAM error\n"); (void) fprintf (stderr, "%s: Internal PAM error retrieving username\n", Prog); @@ -686,14 +683,13 @@ static /*@only@*/struct passwd * do_check_perms (void) } tmp_name = item; if (!streq(name, tmp_name)) { - SYSLOG ((LOG_INFO, - "Change user from '%s' to '%s' as requested by PAM", - name, tmp_name)); + SYSLOG(LOG_INFO, + "Change user from '%s' to '%s' as requested by PAM", + name, tmp_name); if (strtcpy_a(name, tmp_name) == -1) { fprintf (stderr, _("Overlong user name '%s'\n"), tmp_name); - SYSLOG ((LOG_NOTICE, "Overlong user name '%s'", - tmp_name)); + SYSLOG(LOG_NOTICE, "Overlong user name '%s'", tmp_name); su_failure (caller_tty, true); } pw = xgetpwnam (name); @@ -701,8 +697,7 @@ static /*@only@*/struct passwd * do_check_perms (void) (void) fprintf (stderr, _("No passwd entry for user '%s'\n"), name); - SYSLOG ((LOG_NOTICE, - "No passwd entry for user '%s'", name)); + SYSLOG(LOG_NOTICE, "No passwd entry for user '%s'", name); su_failure (caller_tty, true); } } @@ -784,8 +779,8 @@ save_caller_context(void) fprintf (stderr, _("%s: Cannot determine your user name.\n"), Prog); - SYSLOG ((LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", - (unsigned long) caller_uid)); + SYSLOG(LOG_WARN, "Cannot determine the user name of the caller (UID %lu)", + (unsigned long) caller_uid); su_failure (caller_tty, true); /* unknown target UID*/ } strtcpy_a(caller_name, pw->pw_name); @@ -873,7 +868,7 @@ static void process_flags (int argc, char **argv) } else { root_pw = getpwuid (0); if (NULL == root_pw) { - SYSLOG ((LOG_CRIT, "There is no UID 0 user.")); + SYSLOG(LOG_CRIT, "There is no UID 0 user."); su_failure (caller_tty, true); } (void) strcpy (name, root_pw->pw_name); @@ -1034,7 +1029,7 @@ int main (int argc, char **argv) #ifdef USE_PAM ret = pam_start (Prog, name, &conv, &pamh); if (PAM_SUCCESS != ret) { - SYSLOG((LOG_ERR, "pam_start: error %d", ret)); + SYSLOG(LOG_ERR, "pam_start: error %d", ret); fprintf(stderr, _("%s: pam_start: error %d\n"), Prog, ret); exit (1); } @@ -1044,8 +1039,7 @@ int main (int argc, char **argv) ret = pam_set_item (pamh, PAM_RUSER, caller_name); } if (PAM_SUCCESS != ret) { - SYSLOG ((LOG_ERR, "pam_set_item: %s", - pam_strerror (pamh, ret))); + SYSLOG(LOG_ERR, "pam_set_item: %s", pam_strerror(pamh, ret)); fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret)); pam_end (pamh, ret); exit (1); @@ -1088,9 +1082,9 @@ int main (int argc, char **argv) sulog (caller_tty, true, caller_name, name); /* save SU information */ if (getdef_bool ("SYSLOG_SU_ENAB")) { - SYSLOG ((LOG_INFO, "+ %s %s:%s", caller_tty, - (!streq(caller_name, "")) ? caller_name : "???", - (!streq(name, "")) ? name : "???")); + SYSLOG(LOG_INFO, "+ %s %s:%s", caller_tty, + (!streq(caller_name, "")) ? caller_name : "???", + (!streq(name, "")) ? name : "???"); } #ifdef USE_PAM @@ -1106,7 +1100,7 @@ int main (int argc, char **argv) */ ret = pam_setcred (pamh, PAM_ESTABLISH_CRED); if (PAM_SUCCESS != ret) { - SYSLOG ((LOG_ERR, "pam_setcred: %s", pam_strerror (pamh, ret))); + SYSLOG(LOG_ERR, "pam_setcred: %s", pam_strerror(pamh, ret)); fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret)); (void) pam_end (pamh, ret); exit (1); @@ -1114,8 +1108,7 @@ int main (int argc, char **argv) ret = pam_open_session (pamh, 0); if (PAM_SUCCESS != ret) { - SYSLOG ((LOG_ERR, "pam_open_session: %s", - pam_strerror (pamh, ret))); + SYSLOG(LOG_ERR, "pam_open_session: %s", pam_strerror(pamh, ret)); fprintf (stderr, _("%s: %s\n"), Prog, pam_strerror (pamh, ret)); pam_setcred (pamh, PAM_DELETE_CRED); (void) pam_end (pamh, ret); diff --git a/src/suauth.c b/src/suauth.c index 4b86afb3f..edf22f043 100644 --- a/src/suauth.c +++ b/src/suauth.c @@ -67,9 +67,8 @@ check_su_auth(const char *actual_id, const char *wanted_id, bool su_to_root) if (ENOENT == err) { return NOACTION; } - SYSLOG ((LOG_ERR, - "could not open/read config file '%s': %s\n", - SUAUTHFILE, strerror (err))); + SYSLOG(LOG_ERR, "could not open/read config file '%s': %s\n", + SUAUTHFILE, strerror(err)); return DENY; } @@ -79,9 +78,9 @@ check_su_auth(const char *actual_id, const char *wanted_id, bool su_to_root) lines++; if (stpsep(temp, "\n") == NULL) { - SYSLOG ((LOG_ERR, - "%s, line %jd: line too long or missing newline", - SUAUTHFILE, lines)); + SYSLOG(LOG_ERR, + "%s, line %jd: line too long or missing newline", + SUAUTHFILE, lines); continue; } @@ -95,9 +94,8 @@ check_su_auth(const char *actual_id, const char *wanted_id, bool su_to_root) from_users = strsep(&p, ":"); action = strsep(&p, ":"); if (action == NULL || p != NULL) { - SYSLOG ((LOG_ERR, - "%s, line %jd. Bad number of fields.\n", - SUAUTHFILE, lines)); + SYSLOG(LOG_ERR, "%s, line %jd. Bad number of fields.\n", + SUAUTHFILE, lines); continue; } @@ -106,32 +104,31 @@ check_su_auth(const char *actual_id, const char *wanted_id, bool su_to_root) if (!applies (actual_id, from_users)) continue; if (streq(action, "DENY")) { - SYSLOG ((su_to_root ? LOG_WARN : LOG_NOTICE, - "DENIED su from '%s' to '%s' (%s)\n", - actual_id, wanted_id, SUAUTHFILE)); + SYSLOG(su_to_root ? LOG_WARN : LOG_NOTICE, + "DENIED su from '%s' to '%s' (%s)\n", + actual_id, wanted_id, SUAUTHFILE); fputs (_("Access to su to that account DENIED.\n"), stderr); fclose (authfile_fd); return DENY; } else if (streq(action, "NOPASS")) { - SYSLOG ((su_to_root ? LOG_NOTICE : LOG_INFO, - "NO password asked for su from '%s' to '%s' (%s)\n", - actual_id, wanted_id, SUAUTHFILE)); + SYSLOG(su_to_root ? LOG_NOTICE : LOG_INFO, + "NO password asked for su from '%s' to '%s' (%s)\n", + actual_id, wanted_id, SUAUTHFILE); fputs (_("Password authentication bypassed.\n"),stderr); fclose (authfile_fd); return NOPWORD; } else if (streq(action, "OWNPASS")) { - SYSLOG ((su_to_root ? LOG_NOTICE : LOG_INFO, - "su from '%s' to '%s': asking for user's own password (%s)\n", - actual_id, wanted_id, SUAUTHFILE)); + SYSLOG(su_to_root ? LOG_NOTICE : LOG_INFO, + "su from '%s' to '%s': asking for user's own password (%s)\n", + actual_id, wanted_id, SUAUTHFILE); fputs (_("Please enter your OWN password as authentication.\n"), stderr); fclose (authfile_fd); return OWNPWORD; } else { - SYSLOG ((LOG_ERR, - "%s, line %jd: unrecognized action!\n", - SUAUTHFILE, lines)); + SYSLOG(LOG_ERR, "%s, line %jd: unrecognized action!\n", + SUAUTHFILE, lines); } } fclose (authfile_fd); @@ -149,25 +146,22 @@ applies(const char *single, char *list) if (streq(tok, "ALL")) { if (state != 0) { - SYSLOG ((LOG_ERR, - "%s, line %jd: ALL in bad place\n", - SUAUTHFILE, lines)); + SYSLOG(LOG_ERR, "%s, line %jd: ALL in bad place\n", + SUAUTHFILE, lines); return 0; } state = 1; } else if (streq(tok, "EXCEPT")) { if (state != 1) { - SYSLOG ((LOG_ERR, - "%s, line %jd: EXCEPT in bas place\n", - SUAUTHFILE, lines)); + SYSLOG(LOG_ERR, "%s, line %jd: EXCEPT in bas place\n", + SUAUTHFILE, lines); return 0; } state = 2; } else if (streq(tok, "GROUP")) { if ((state != 0) && (state != 2)) { - SYSLOG ((LOG_ERR, - "%s, line %jd: GROUP in bad place\n", - SUAUTHFILE, lines)); + SYSLOG(LOG_ERR, "%s, line %jd: GROUP in bad place\n", + SUAUTHFILE, lines); return 0; } state = (state == 0) ? 3 : 4; @@ -178,9 +172,9 @@ applies(const char *single, char *list) return 1; break; case 1: /* An all */ - SYSLOG ((LOG_ERR, - "%s, line %jd: expect another token after ALL\n", - SUAUTHFILE, lines)); + SYSLOG(LOG_ERR, + "%s, line %jd: expect another token after ALL\n", + SUAUTHFILE, lines); return 0; case 2: /* All except */ if (streq(tok, single)) diff --git a/src/useradd.c b/src/useradd.c index fbc7e7b25..6570cee83 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -266,40 +266,40 @@ static void fail_exit (int code, bool process_selinux) fprintf(stderr, _("%s: %s was created, but could not be removed\n"), Prog, prefix_user_home); - SYSLOG((LOG_ERR, "failed to remove %s", prefix_user_home)); + SYSLOG(LOG_ERR, "failed to remove %s", prefix_user_home); } if (spw_locked && spw_unlock(process_selinux) == 0) { fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname()); - SYSLOG((LOG_ERR, "failed to unlock %s", spw_dbname())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } if (pw_locked && pw_unlock(process_selinux) == 0) { fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname()); - SYSLOG((LOG_ERR, "failed to unlock %s", pw_dbname())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } if (gr_locked && gr_unlock(process_selinux) == 0) { fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname()); - SYSLOG((LOG_ERR, "failed to unlock %s", gr_dbname())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } #ifdef SHADOWGRP if (sgr_locked && sgr_unlock(process_selinux) == 0) { fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname()); - SYSLOG((LOG_ERR, "failed to unlock %s", sgr_dbname())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } #endif #ifdef ENABLE_SUBIDS if (sub_uid_locked && sub_uid_unlock(process_selinux) == 0) { fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname()); - SYSLOG((LOG_ERR, "failed to unlock %s", sub_uid_dbname())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); /* continue */ } if (sub_gid_locked && sub_gid_unlock(process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); /* continue */ } #endif /* ENABLE_SUBIDS */ @@ -314,7 +314,7 @@ static void fail_exit (int code, bool process_selinux) "add-user", user_name, AUDIT_NO_ID, SHADOW_AUDIT_FAILURE); #endif - SYSLOG((LOG_INFO, "failed adding user '%s', exit code: %d", user_name, code)); + SYSLOG(LOG_INFO, "failed adding user '%s', exit code: %d", user_name, code); exit(code); } @@ -732,12 +732,12 @@ set_defaults(void) NULL, AUDIT_NO_ID, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, + SYSLOG(LOG_INFO, "useradd defaults: GROUP=%u, HOME=%s, SHELL=%s, INACTIVE=%ld, " "EXPIRE=%s, SKEL=%s, CREATE_MAIL_SPOOL=%s, LOG_INIT=%s", (unsigned int) def_group, def_home, def_shell, def_inactive, def_expire, def_template, - def_create_mail_spool, def_log_init)); + def_create_mail_spool, def_log_init); ret = 0; err_free_def: @@ -1040,7 +1040,7 @@ static void grp_update (bool process_selinux) fprintf (stderr, _("%s: Out of memory. Cannot update %s.\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to prepare the new %s entry '%s'", gr_dbname (), user_name)); + SYSLOG(LOG_ERR, "failed to prepare the new %s entry '%s'", gr_dbname(), user_name); fail_exit (E_GRP_UPDATE, process_selinux); /* XXX */ } @@ -1053,7 +1053,7 @@ static void grp_update (bool process_selinux) fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), Prog, gr_dbname (), ngrp->gr_name); - SYSLOG ((LOG_ERR, "failed to prepare the new %s entry '%s'", gr_dbname (), user_name)); + SYSLOG(LOG_ERR, "failed to prepare the new %s entry '%s'", gr_dbname(), user_name); fail_exit (E_GRP_UPDATE, process_selinux); } #ifdef WITH_AUDIT @@ -1062,9 +1062,7 @@ static void grp_update (bool process_selinux) user_name, AUDIT_NO_ID, "grp", ngrp->gr_name, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "add '%s' to group '%s'", - user_name, ngrp->gr_name)); + SYSLOG(LOG_INFO, "add '%s' to group '%s'", user_name, ngrp->gr_name); } #ifdef SHADOWGRP @@ -1103,7 +1101,7 @@ static void grp_update (bool process_selinux) fprintf (stderr, _("%s: Out of memory. Cannot update %s.\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to prepare the new %s entry '%s'", sgr_dbname (), user_name)); + SYSLOG(LOG_ERR, "failed to prepare the new %s entry '%s'", sgr_dbname(), user_name); fail_exit (E_GRP_UPDATE, process_selinux); /* XXX */ } @@ -1116,7 +1114,7 @@ static void grp_update (bool process_selinux) fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), Prog, sgr_dbname (), nsgrp->sg_namp); - SYSLOG ((LOG_ERR, "failed to prepare the new %s entry '%s'", sgr_dbname (), user_name)); + SYSLOG(LOG_ERR, "failed to prepare the new %s entry '%s'", sgr_dbname(), user_name); fail_exit (E_GRP_UPDATE, process_selinux); } @@ -1126,9 +1124,8 @@ static void grp_update (bool process_selinux) user_name, AUDIT_NO_ID, "grp", nsgrp->sg_namp, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "add '%s' to shadow group '%s'", - user_name, nsgrp->sg_namp)); + SYSLOG(LOG_INFO, "add '%s' to shadow group '%s'", + user_name, nsgrp->sg_namp); } #endif /* SHADOWGRP */ } @@ -1600,13 +1597,13 @@ static void close_files(const struct option_flags *flags) if (pw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (E_PW_UPDATE, process_selinux); } if (is_shadow_pwd && (spw_close (process_selinux) == 0)) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (E_PW_UPDATE, process_selinux); } @@ -1616,20 +1613,20 @@ static void close_files(const struct option_flags *flags) if (is_sub_uid && (sub_uid_close (process_selinux) == 0)) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_uid_dbname()); fail_exit (E_SUB_UID_UPDATE, process_selinux); } if (is_sub_gid && (sub_gid_close (process_selinux) == 0)) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_gid_dbname()); fail_exit (E_SUB_GID_UPDATE, process_selinux); } #endif /* ENABLE_SUBIDS */ if (is_shadow_pwd) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "unlocking-shadow-file", @@ -1642,7 +1639,7 @@ static void close_files(const struct option_flags *flags) } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "unlocking-passwd-file", @@ -1659,7 +1656,7 @@ static void close_files(const struct option_flags *flags) if (is_sub_uid) { if (sub_uid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "unlocking-subordinate-user-file", @@ -1673,7 +1670,7 @@ static void close_files(const struct option_flags *flags) if (is_sub_gid) { if (sub_gid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "unlocking-subordinate-group-file", @@ -1702,7 +1699,7 @@ static void close_group_files (bool process_selinux) fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname()); - SYSLOG((LOG_ERR, "failure while writing changes to %s", gr_dbname())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", gr_dbname()); fail_exit(E_GRP_UPDATE, process_selinux); } #ifdef SHADOWGRP @@ -1710,7 +1707,7 @@ static void close_group_files (bool process_selinux) fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname()); - SYSLOG((LOG_ERR, "failure while writing changes to %s", sgr_dbname())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sgr_dbname()); fail_exit(E_GRP_UPDATE, process_selinux); } #endif /* SHADOWGRP */ @@ -1726,7 +1723,7 @@ static void unlock_group_files (bool process_selinux) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "unlocking-group-file", @@ -1740,7 +1737,7 @@ static void unlock_group_files (bool process_selinux) if (is_shadow_grp) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_USER, "unlocking-gshadow-file", @@ -1962,7 +1959,7 @@ static void grp_add (bool process_selinux) fail_exit (E_GRP_UPDATE, process_selinux); } #endif /* SHADOWGRP */ - SYSLOG ((LOG_INFO, "new group: name=%s, GID=%u", user_name, user_gid)); + SYSLOG(LOG_INFO, "new group: name=%s, GID=%u", user_name, user_gid); #ifdef WITH_AUDIT audit_logger (AUDIT_ADD_GROUP, "add-group", @@ -1990,7 +1987,7 @@ static void faillog_reset (uid_t uid) fprintf (stderr, _("%s: failed to open the faillog file for UID %lu: %s\n"), Prog, (unsigned long) uid, strerrno()); - SYSLOG ((LOG_WARN, "failed to open the faillog file for UID %lu", (unsigned long) uid)); + SYSLOG(LOG_WARN, "failed to open the faillog file for UID %lu", (unsigned long) uid); return; } if ( (lseek (fd, offset_uid, SEEK_SET) != offset_uid) @@ -1999,13 +1996,13 @@ static void faillog_reset (uid_t uid) fprintf (stderr, _("%s: failed to reset the faillog entry of UID %lu: %s\n"), Prog, (unsigned long) uid, strerrno()); - SYSLOG ((LOG_WARN, "failed to reset the faillog entry of UID %lu", (unsigned long) uid)); + SYSLOG(LOG_WARN, "failed to reset the faillog entry of UID %lu", (unsigned long) uid); } if (close (fd) != 0 && errno != EINTR) { fprintf (stderr, _("%s: failed to close the faillog file for UID %lu: %s\n"), Prog, (unsigned long) uid, strerrno()); - SYSLOG ((LOG_WARN, "failed to close the faillog file for UID %lu", (unsigned long) uid)); + SYSLOG(LOG_WARN, "failed to close the faillog file for UID %lu", (unsigned long) uid); } } @@ -2035,7 +2032,7 @@ static void lastlog_reset (uid_t uid) fprintf (stderr, _("%s: failed to open the lastlog file for UID %lu: %s\n"), Prog, (unsigned long) uid, strerrno()); - SYSLOG ((LOG_WARN, "failed to open the lastlog file for UID %lu", (unsigned long) uid)); + SYSLOG(LOG_WARN, "failed to open the lastlog file for UID %lu", (unsigned long) uid); return; } if ( (lseek (fd, offset_uid, SEEK_SET) != offset_uid) @@ -2044,14 +2041,14 @@ static void lastlog_reset (uid_t uid) fprintf (stderr, _("%s: failed to reset the lastlog entry of UID %lu: %s\n"), Prog, (unsigned long) uid, strerrno()); - SYSLOG ((LOG_WARN, "failed to reset the lastlog entry of UID %lu", (unsigned long) uid)); + SYSLOG(LOG_WARN, "failed to reset the lastlog entry of UID %lu", (unsigned long) uid); /* continue */ } if (close (fd) != 0 && errno != EINTR) { fprintf (stderr, _("%s: failed to close the lastlog file for UID %lu: %s\n"), Prog, (unsigned long) uid, strerrno()); - SYSLOG ((LOG_WARN, "failed to close the lastlog file for UID %lu", (unsigned long) uid)); + SYSLOG(LOG_WARN, "failed to close the lastlog file for UID %lu", (unsigned long) uid); /* continue */ } } @@ -2096,7 +2093,7 @@ static void tallylog_reset (const char *user_name) fprintf (stderr, _("%s: failed to reset the tallylog entry of user \"%s\"\n"), Prog, user_name); - SYSLOG ((LOG_WARN, "failed to reset the tallylog entry of user \"%s\"", user_name)); + SYSLOG(LOG_WARN, "failed to reset the tallylog entry of user \"%s\"", user_name); } return; @@ -2131,11 +2128,11 @@ usr_update (unsigned long subuid_count, unsigned long subgid_count, * happens so we know what we were trying to accomplish. */ tty=ttyname (STDIN_FILENO); - SYSLOG ((LOG_INFO, + SYSLOG(LOG_INFO, "new user: name=%s, UID=%u, GID=%u, home=%s, shell=%s, from=%s", user_name, (unsigned int) user_id, (unsigned int) user_gid, user_home, user_shell, - tty ? tty : "none" )); + tty ? tty : "none"); /* * Initialize faillog and lastlog entries for this UID in case diff --git a/src/userdel.c b/src/userdel.c index 925092abe..9f85d8acf 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -217,8 +217,8 @@ static void update_groups (bool process_selinux) user_name, user_id, "grp", ngrp->gr_name, SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ - SYSLOG ((LOG_INFO, "delete '%s' from group '%s'\n", - user_name, ngrp->gr_name)); + SYSLOG(LOG_INFO, "delete '%s' from group '%s'\n", + user_name, ngrp->gr_name); } if (getdef_bool ("USERGROUPS_ENAB")) { @@ -279,8 +279,8 @@ static void update_groups (bool process_selinux) user_name, user_id, nsgrp->sg_namp, "grp", SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ - SYSLOG ((LOG_INFO, "delete '%s' from shadow group '%s'\n", - user_name, nsgrp->sg_namp)); + SYSLOG(LOG_INFO, "delete '%s' from shadow group '%s'\n", + user_name, nsgrp->sg_namp); } #endif /* SHADOWGRP */ } @@ -358,9 +358,8 @@ static void remove_usergroup (bool process_selinux) user_name, AUDIT_NO_ID, "grp", user_name, SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ - SYSLOG ((LOG_INFO, - "removed group '%s' owned by '%s'\n", - user_name, user_name)); + SYSLOG(LOG_INFO, "removed group '%s' owned by '%s'\n", + user_name, user_name); #ifdef SHADOWGRP if (sgr_locate (user_name) != NULL) { @@ -376,9 +375,8 @@ static void remove_usergroup (bool process_selinux) user_name, AUDIT_NO_ID, "grp", user_name, SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ - SYSLOG ((LOG_INFO, - "removed shadow group '%s' owned by '%s'\n", - user_name, user_name)); + SYSLOG(LOG_INFO, "removed shadow group '%s' owned by '%s'\n", + user_name, user_name); } #endif /* SHADOWGRP */ @@ -399,12 +397,12 @@ static void close_files(const struct option_flags *flags) if (pw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (E_PW_UPDATE, process_selinux); } if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } pw_locked = false; @@ -413,12 +411,12 @@ static void close_files(const struct option_flags *flags) if (spw_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (E_PW_UPDATE, process_selinux); } if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } spw_locked = false; @@ -426,12 +424,12 @@ static void close_files(const struct option_flags *flags) if (gr_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", gr_dbname()); fail_exit (E_GRP_UPDATE, process_selinux); } if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } gr_locked = false; @@ -441,13 +439,13 @@ static void close_files(const struct option_flags *flags) if (sgr_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sgr_dbname()); fail_exit (E_GRP_UPDATE, process_selinux); } if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } sgr_locked = false; @@ -458,12 +456,12 @@ static void close_files(const struct option_flags *flags) if (is_sub_uid) { if (sub_uid_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_uid_dbname()); fail_exit (E_SUB_UID_UPDATE, process_selinux); } if (sub_uid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); /* continue */ } sub_uid_locked = false; @@ -472,12 +470,12 @@ static void close_files(const struct option_flags *flags) if (is_sub_gid) { if (sub_gid_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_gid_dbname()); fail_exit (E_SUB_GID_UPDATE, process_selinux); } if (sub_gid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); /* continue */ } sub_gid_locked = false; @@ -493,21 +491,21 @@ static void fail_exit (int code, bool process_selinux) if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } if (spw_locked) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } @@ -515,7 +513,7 @@ static void fail_exit (int code, bool process_selinux) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -524,14 +522,14 @@ static void fail_exit (int code, bool process_selinux) if (sub_uid_locked) { if (sub_uid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); /* continue */ } } if (sub_gid_locked) { if (sub_gid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); /* continue */ } } @@ -681,7 +679,7 @@ static void update_user (bool process_selinux) "delete-user", user_name, user_id, SHADOW_AUDIT_SUCCESS); #endif /* WITH_AUDIT */ - SYSLOG ((LOG_INFO, "delete user '%s'\n", user_name)); + SYSLOG(LOG_INFO, "delete user '%s'\n", user_name); } /* @@ -774,7 +772,7 @@ static bool remove_mailbox (void) fprintf (stderr, _("%s: warning: can't remove %s: %s\n"), Prog, mailfile, strerrno()); - SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno())); + SYSLOG(LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()); #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_USER, "delete-mail-file", @@ -790,7 +788,7 @@ static bool remove_mailbox (void) fprintf (stderr, _("%s: warning: can't remove %s: %s\n"), Prog, mailfile, strerrno()); - SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno())); + SYSLOG(LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()); #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_USER, "delete-mail-file", @@ -815,7 +813,7 @@ static bool remove_mailbox (void) fprintf (stderr, _("%s: %s not owned by %s, not removing\n"), Prog, mailfile, user_name); - SYSLOG((LOG_ERR, "%s not owned by %s, not removed", mailfile, user_name)); + SYSLOG(LOG_ERR, "%s not owned by %s, not removed", mailfile, user_name); #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_USER, "delete-mail-file", @@ -831,7 +829,7 @@ static bool remove_mailbox (void) fprintf (stderr, _("%s: warning: can't remove %s: %s\n"), Prog, mailfile, strerrno()); - SYSLOG((LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno())); + SYSLOG(LOG_ERR, "Cannot remove %s: %s", mailfile, strerrno()); #ifdef WITH_AUDIT audit_logger (AUDIT_DEL_USER, "delete-mail-file", diff --git a/src/usermod.c b/src/usermod.c index 19770d631..194f6145f 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -470,7 +470,7 @@ new_pw_passwd(char *pw_pass, bool process_selinux) audit_logger (AUDIT_USER_CHAUTHTOK, "updating-passwd", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, "lock user '%s' password", user_newname)); + SYSLOG(LOG_INFO, "lock user '%s' password", user_newname); pw_pass = xaprintf("!%s", pw_pass); } else if (Uflg && strprefix(pw_pass, "!")) { if (pw_pass[1] == '\0') { @@ -485,14 +485,14 @@ new_pw_passwd(char *pw_pass, bool process_selinux) audit_logger (AUDIT_USER_CHAUTHTOK, "updating-password", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, "unlock user '%s' password", user_newname)); + SYSLOG(LOG_INFO, "unlock user '%s' password", user_newname); memmove(pw_pass, pw_pass + 1, strlen(pw_pass)); } else if (pflg) { #ifdef WITH_AUDIT audit_logger (AUDIT_USER_CHAUTHTOK, "updating-password", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, "change user '%s' password", user_newname)); + SYSLOG(LOG_INFO, "change user '%s' password", user_newname); pw_pass = xstrdup (user_pass); } return pw_pass; @@ -521,9 +521,8 @@ static void new_pwent (struct passwd *pwent, bool process_selinux) audit_logger (AUDIT_USER_MGMT, "changing-name", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, - "change user name '%s' to '%s'", - pwent->pw_name, user_newname)); + SYSLOG(LOG_INFO, "change user name '%s' to '%s'", + pwent->pw_name, user_newname); pwent->pw_name = xstrdup (user_newname); } /* Update the password in passwd if there is no shadow file or if @@ -541,9 +540,8 @@ static void new_pwent (struct passwd *pwent, bool process_selinux) audit_logger (AUDIT_USER_MGMT, "changing-uid", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, - "change user '%s' UID from '%d' to '%d'", - pwent->pw_name, pwent->pw_uid, user_newid)); + SYSLOG(LOG_INFO, "change user '%s' UID from '%d' to '%d'", + pwent->pw_name, pwent->pw_uid, user_newid); pwent->pw_uid = user_newid; } if (gflg) { @@ -552,9 +550,8 @@ static void new_pwent (struct passwd *pwent, bool process_selinux) "changing-primary-group", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, - "change user '%s' GID from '%d' to '%d'", - pwent->pw_name, pwent->pw_gid, user_newgid)); + SYSLOG(LOG_INFO, "change user '%s' GID from '%d' to '%d'", + pwent->pw_name, pwent->pw_gid, user_newgid); pwent->pw_gid = user_newgid; } if (cflg) { @@ -571,9 +568,8 @@ static void new_pwent (struct passwd *pwent, bool process_selinux) "changing-home-dir", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, - "change user '%s' home from '%s' to '%s'", - pwent->pw_name, pwent->pw_dir, user_newhome)); + SYSLOG(LOG_INFO, "change user '%s' home from '%s' to '%s'", + pwent->pw_name, pwent->pw_dir, user_newhome); if (!streq(user_newhome, "")) stpcpy(stprspn(user_newhome + 1, "/"), ""); @@ -586,9 +582,8 @@ static void new_pwent (struct passwd *pwent, bool process_selinux) "changing-shell", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, - "change user '%s' shell from '%s' to '%s'", - pwent->pw_name, pwent->pw_shell, user_newshell)); + SYSLOG(LOG_INFO, "change user '%s' shell from '%s' to '%s'", + pwent->pw_name, pwent->pw_shell, user_newshell); pwent->pw_shell = user_newshell; } } @@ -617,9 +612,8 @@ static void new_spent (struct spwd *spent, bool process_selinux) "changing-inactive-days", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, - "change user '%s' inactive from '%ld' to '%ld'", - spent->sp_namp, spent->sp_inact, user_newinactive)); + SYSLOG(LOG_INFO, "change user '%s' inactive from '%ld' to '%ld'", + spent->sp_namp, spent->sp_inact, user_newinactive); spent->sp_inact = user_newinactive; } if (eflg) { @@ -633,9 +627,8 @@ static void new_spent (struct spwd *spent, bool process_selinux) "changing-expiration-date", user_newname, user_newid, 1); #endif - SYSLOG ((LOG_INFO, - "change user '%s' expiration from '%s' to '%s'", - spent->sp_namp, old_exp, new_exp)); + SYSLOG(LOG_INFO, "change user '%s' expiration from '%s' to '%s'", + spent->sp_namp, old_exp, new_exp); spent->sp_expire = user_newexpire; } @@ -670,7 +663,7 @@ fail_exit (int code, bool process_selinux) if (gr_locked) { if (gr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -678,7 +671,7 @@ fail_exit (int code, bool process_selinux) if (sgr_locked) { if (sgr_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -686,14 +679,14 @@ fail_exit (int code, bool process_selinux) if (spw_locked) { if (spw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } if (pw_locked) { if (pw_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } } @@ -701,14 +694,14 @@ fail_exit (int code, bool process_selinux) if (sub_uid_locked) { if (sub_uid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); /* continue */ } } if (sub_gid_locked) { if (sub_gid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); /* continue */ } } @@ -794,10 +787,10 @@ update_group(const struct group *grp, bool process_selinux) ngrp->gr_name, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "change '%s' to '%s' in group '%s'", - user_name, user_newname, - ngrp->gr_name)); + SYSLOG(LOG_INFO, + "change '%s' to '%s' in group '%s'", + user_name, user_newname, + ngrp->gr_name); } } else { /* User was a member but is no more a @@ -812,9 +805,8 @@ update_group(const struct group *grp, bool process_selinux) ngrp->gr_name, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "delete '%s' from group '%s'", - user_name, ngrp->gr_name)); + SYSLOG(LOG_INFO, "delete '%s' from group '%s'", + user_name, ngrp->gr_name); } } else if (is_member) { /* User was not a member but is now a member this @@ -829,8 +821,8 @@ update_group(const struct group *grp, bool process_selinux) ngrp->gr_name, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, "add '%s' to group '%s'", - user_newname, ngrp->gr_name)); + SYSLOG(LOG_INFO, "add '%s' to group '%s'", + user_newname, ngrp->gr_name); } if (!changed) goto free_ngrp; @@ -839,7 +831,7 @@ update_group(const struct group *grp, bool process_selinux) fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), Prog, gr_dbname (), ngrp->gr_name); - SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", gr_dbname (), ngrp->gr_name)); + SYSLOG(LOG_WARN, "failed to prepare the new %s entry '%s'", gr_dbname(), ngrp->gr_name); fail_exit (E_GRP_UPDATE, process_selinux); } @@ -925,9 +917,8 @@ update_gshadow(const struct sgrp *sgrp, bool process_selinux) user_name, AUDIT_NO_ID, "grp", nsgrp->sg_namp, SHADOW_AUDIT_SUCCESS); #endif - SYSLOG ((LOG_INFO, - "change admin '%s' to '%s' in shadow group '%s'", - user_name, user_newname, nsgrp->sg_namp)); + SYSLOG(LOG_INFO, "change admin '%s' to '%s' in shadow group '%s'", + user_name, user_newname, nsgrp->sg_namp); } if (was_member) { @@ -948,10 +939,9 @@ update_gshadow(const struct sgrp *sgrp, bool process_selinux) user_name, AUDIT_NO_ID, "grp", nsgrp->sg_namp, 1); #endif - SYSLOG ((LOG_INFO, - "change '%s' to '%s' in shadow group '%s'", - user_name, user_newname, - nsgrp->sg_namp)); + SYSLOG(LOG_INFO, + "change '%s' to '%s' in shadow group '%s'", + user_name, user_newname, nsgrp->sg_namp); } } else { /* User was a member but is no more a @@ -965,9 +955,8 @@ update_gshadow(const struct sgrp *sgrp, bool process_selinux) user_name, AUDIT_NO_ID, "grp", nsgrp->sg_namp, 1); #endif - SYSLOG ((LOG_INFO, - "delete '%s' from shadow group '%s'", - user_name, nsgrp->sg_namp)); + SYSLOG(LOG_INFO, "delete '%s' from shadow group '%s'", + user_name, nsgrp->sg_namp); } } else if (is_member) { /* User was not a member but is now a member this @@ -981,8 +970,8 @@ update_gshadow(const struct sgrp *sgrp, bool process_selinux) user_newname, AUDIT_NO_ID, "grp", nsgrp->sg_namp, 1); #endif - SYSLOG ((LOG_INFO, "add '%s' to shadow group '%s'", - user_newname, nsgrp->sg_namp)); + SYSLOG(LOG_INFO, "add '%s' to shadow group '%s'", + user_newname, nsgrp->sg_namp); } if (!changed) goto free_nsgrp; @@ -994,8 +983,8 @@ update_gshadow(const struct sgrp *sgrp, bool process_selinux) fprintf (stderr, _("%s: failed to prepare the new %s entry '%s'\n"), Prog, sgr_dbname (), nsgrp->sg_namp); - SYSLOG ((LOG_WARN, "failed to prepare the new %s entry '%s'", - sgr_dbname (), nsgrp->sg_namp)); + SYSLOG(LOG_WARN, "failed to prepare the new %s entry '%s'", + sgr_dbname(), nsgrp->sg_namp); fail_exit (E_GRP_UPDATE, process_selinux); } @@ -1521,16 +1510,14 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", pw_dbname()); fail_exit (E_PW_UPDATE, process_selinux); } if (is_shadow_pwd && (spw_close (process_selinux) == 0)) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, - "failure while writing changes to %s", - spw_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", spw_dbname()); fail_exit (E_PW_UPDATE, process_selinux); } @@ -1539,9 +1526,8 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, - "failure while writing changes to %s", - gr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", + gr_dbname()); fail_exit (E_GRP_UPDATE, process_selinux); } #ifdef SHADOWGRP @@ -1550,9 +1536,8 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, - "failure while writing changes to %s", - sgr_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", + sgr_dbname()); fail_exit (E_GRP_UPDATE, process_selinux); } } @@ -1563,9 +1548,7 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname ()); - SYSLOG ((LOG_ERR, - "failed to unlock %s", - sgr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sgr_dbname()); /* continue */ } } @@ -1574,9 +1557,7 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname ()); - SYSLOG ((LOG_ERR, - "failed to unlock %s", - gr_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", gr_dbname()); /* continue */ } } @@ -1586,9 +1567,7 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname ()); - SYSLOG ((LOG_ERR, - "failed to unlock %s", - spw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", spw_dbname()); /* continue */ } } @@ -1596,7 +1575,7 @@ static void close_files(const struct option_flags *flags) fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", pw_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", pw_dbname()); /* continue */ } @@ -1611,12 +1590,12 @@ static void close_files(const struct option_flags *flags) if (vflg || Vflg) { if (sub_uid_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_uid_dbname()); fail_exit (E_SUB_UID_UPDATE, process_selinux); } if (sub_uid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_uid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_uid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_uid_dbname()); /* continue */ } sub_uid_locked = false; @@ -1624,12 +1603,12 @@ static void close_files(const struct option_flags *flags) if (wflg || Wflg) { if (sub_gid_close (process_selinux) == 0) { fprintf (stderr, _("%s: failure while writing changes to %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failure while writing changes to %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failure while writing changes to %s", sub_gid_dbname()); fail_exit (E_SUB_GID_UPDATE, process_selinux); } if (sub_gid_unlock (process_selinux) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, sub_gid_dbname ()); - SYSLOG ((LOG_ERR, "failed to unlock %s", sub_gid_dbname ())); + SYSLOG(LOG_ERR, "failed to unlock %s", sub_gid_dbname()); /* continue */ } sub_gid_locked = false; diff --git a/src/vipw.c b/src/vipw.c index cf574c9db..f6a3b72ee 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -166,7 +166,7 @@ static void vipwexit (const char *msg, int syserr, int ret) if (filelocked) { if ((*unlock) (true) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, fileeditname); - SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname)); + SYSLOG(LOG_ERR, "failed to unlock %s", fileeditname); /* continue */ } } @@ -466,10 +466,10 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (bool)) if ((*file_unlock) (true) == 0) { fprintf (stderr, _("%s: failed to unlock %s\n"), Prog, fileeditname); - SYSLOG ((LOG_ERR, "failed to unlock %s", fileeditname)); + SYSLOG(LOG_ERR, "failed to unlock %s", fileeditname); /* continue */ } - SYSLOG ((LOG_INFO, "file %s edited", fileeditname)); + SYSLOG(LOG_INFO, "file %s edited", fileeditname); } int main (int argc, char **argv)