-/*
+/*-
+ * SPDX-License-Identifier: BSD-4-Clause
+ *
* Copyright (c) 1988, 1993, 1994
* The Regents of the University of California. All rights reserved.
* Copyright (c) 2002 Networks Associates Technology, Inc.
#include <grp.h>
#include <paths.h>
#include <pwd.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include "chpass.h"
}
errno = 0;
id = strtoul(p, &np, 10);
- if (*np || (id == ULONG_MAX && errno == ERANGE)) {
+ if (*np || (id == (uid_t)ULONG_MAX && errno == ERANGE)) {
warnx("illegal uid");
return (-1);
}
}
errno = 0;
id = strtoul(p, &np, 10);
- if (*np || (id == ULONG_MAX && errno == ERANGE)) {
+ if (*np || (id == (uid_t)ULONG_MAX && errno == ERANGE)) {
warnx("illegal gid");
return (-1);
}
int
p_shell(char *p, struct passwd *pw, ENTRY *ep __unused)
{
- char *t;
struct stat sbuf;
if (!*p) {
warnx("%s: current shell non-standard", pw->pw_shell);
return (-1);
}
- if (!(t = ok_shell(p))) {
+ if (!ok_shell(p)) {
if (!master_mode) {
warnx("%s: non-standard shell", p);
return (-1);
}
+ pw->pw_shell = strdup(p);
}
else
- p = t;
- if (!(pw->pw_shell = strdup(p))) {
+ pw->pw_shell = dup_shell(p);
+ if (!pw->pw_shell) {
warnx("can't save entry");
return (-1);
}