int errors = 0;
size_t len;
- for (start = users; start && *start; start = end) {
+ for (start = users; (NULL != start) && ('\0' != *start); start = end) {
end = strchr (start, ',');
if (NULL != end) {
len = end - start;
* This user must exist.
*/
- if (!getpwnam (username)) { /* local, no need for xgetpwnam */
+ /* local, no need for xgetpwnam */
+ if (getpwnam (username) == NULL) {
fprintf (stderr, _("%s: unknown user %s\n"),
Prog, username);
errors++;
case 'a': /* add a user */
user = optarg;
/* local, no need for xgetpwnam */
- if (!getpwnam (user)) {
+ if (getpwnam (user) == NULL) {
fprintf (stderr,
_("%s: unknown user %s\n"), Prog,
user);
exit (2);
}
admins = optarg;
- if (check_list (admins)) {
+ if (check_list (admins) != 0) {
exit (1);
}
Aflg++;
failure ();
}
members = optarg;
- if (check_list (members)) {
+ if (check_list (members) != 0) {
exit (1);
}
Mflg++;
static void update_group (struct group *gr)
#endif
{
- if (!gr_update (gr)) {
+ if (gr_update (gr) == 0) {
fprintf (stderr, _("%s: can't update entry\n"), Prog);
SYSLOG ((LOG_WARN, "cannot update /etc/group"));
#ifdef WITH_AUDIT
exit (1);
}
#ifdef SHADOWGRP
- if (is_shadowgrp && !sgr_update (sg)) {
+ if (is_shadowgrp && (sgr_update (sg) == 0)) {
fprintf (stderr, _("%s: can't update shadow entry\n"), Prog);
SYSLOG ((LOG_WARN, "cannot update /etc/gshadow"));
#ifdef WITH_AUDIT
struct group const*tmpgr = NULL;
struct sgrp const*tmpsg = NULL;
- if (!gr_open (O_RDONLY)) {
+ if (gr_open (O_RDONLY) == 0) {
fprintf (stderr, _("%s: can't open file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot open /etc/group"));
#ifdef WITH_AUDIT
gr->gr_passwd = xstrdup (tmpgr->gr_passwd);
gr->gr_mem = dup_list (tmpgr->gr_mem);
- if (!gr_close ()) {
+ if (gr_close () == 0) {
fprintf (stderr, _("%s: can't close file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot close /etc/group"));
#ifdef WITH_AUDIT
}
#ifdef SHADOWGRP
- if (!sgr_open (O_RDONLY)) {
+ if (sgr_open (O_RDONLY) == 0) {
fprintf (stderr, _("%s: can't open shadow file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot open /etc/gshadow"));
#ifdef WITH_AUDIT
#ifdef FIRST_MEMBER_IS_ADMIN
if (sg->sg_mem[0]) {
sg->sg_adm[0] = xstrdup (sg->sg_mem[0]);
- sg->sg_adm[1] = 0;
+ sg->sg_adm[1] = NULL;
} else
#endif
{
- sg->sg_adm[0] = 0;
+ sg->sg_adm[0] = NULL;
}
}
- if (!sgr_close ()) {
+ if (sgr_close () == 0) {
fprintf (stderr, _("%s: can't close shadow file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot close /etc/gshadow"));
#ifdef WITH_AUDIT
*/
pw = get_my_pwent ();
- if (!pw) {
+ if (NULL == pw) {
fprintf (stderr, _("Who are you?\n"));
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "user lookup", NULL,
* be a tty. The typical keyboard signals are caught so the termio
* modes can be restored.
*/
- if (!isatty (0) || !isatty (1)) {
+ if ((isatty (0) == 0) || (isatty (1) == 0)) {
fprintf (stderr, _("%s: Not a tty\n"), Prog);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "changing password",
* output, etc.
*/
output:
- if (setuid (0)) {
+ if (setuid (0) != 0) {
fprintf (stderr, _("Cannot change ID to root.\n"));
SYSLOG ((LOG_ERR, "can't setuid(0)"));
#ifdef WITH_AUDIT