diff options
-rw-r--r-- | usr.sbin/user/user.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c index 0aba94b4b51..b0a11d624af 100644 --- a/usr.sbin/user/user.c +++ b/usr.sbin/user/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.95 2013/04/02 05:04:47 deraadt Exp $ */ +/* $OpenBSD: user.c,v 1.96 2013/08/06 21:33:03 millert Exp $ */ /* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */ /* @@ -383,7 +383,7 @@ creategid(char *group, gid_t gid, const char *name) return 0; } (void) chmod(_PATH_GROUP, st.st_mode & 07777); - syslog(LOG_INFO, "new group added: name=%s, gid=%d", group, gid); + syslog(LOG_INFO, "new group added: name=%s, gid=%u", group, gid); return 1; } @@ -673,8 +673,8 @@ getnextgid(uid_t *gidp, uid_t lo, uid_t hi) static int save_range(user_t *up, char *cp) { - int from; - int to; + uid_t from; + uid_t to; int i; if (up->u_rsize == 0) { @@ -684,7 +684,7 @@ save_range(user_t *up, char *cp) up->u_rsize *= 2; RENEW(range_t, up->u_rv, up->u_rsize, return(0)); } - if (up->u_rv && sscanf(cp, "%d..%d", &from, &to) == 2) { + if (up->u_rv && sscanf(cp, "%u..%u", &from, &to) == 2) { for (i = up->u_defrc ; i < up->u_rc ; i++) { if (up->u_rv[i].r_from == from && up->u_rv[i].r_to == to) { break; @@ -734,7 +734,7 @@ setdefaults(user_t *up) ret = 0; } for (i = (up->u_defrc != up->u_rc) ? up->u_defrc : 0 ; i < up->u_rc ; i++) { - if (fprintf(fp, "range\t\t%d..%d\n", up->u_rv[i].r_from, up->u_rv[i].r_to) <= 0) { + if (fprintf(fp, "range\t\t%u..%u\n", up->u_rv[i].r_from, up->u_rv[i].r_to) <= 0) { warn("can't write to `%s'", CONFFILE); ret = 0; } @@ -1112,7 +1112,7 @@ adduser(char *login_name, user_t *up) up->u_password, password); } } - cc = snprintf(buf, sizeof(buf), "%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s\n", + cc = snprintf(buf, sizeof(buf), "%s:%s:%u:%u:%s:%ld:%ld:%s:%s:%s\n", login_name, password, up->u_uid, @@ -1184,7 +1184,7 @@ adduser(char *login_name, user_t *up) !creategid(login_name, gid, "")) { (void) close(ptmpfd); pw_abort(); - errx(EXIT_FAILURE, "can't create gid %d for login name %s", + errx(EXIT_FAILURE, "can't create gid %u for login name %s", gid, login_name); } if (up->u_groupc > 0 && !append_group(login_name, up->u_groupc, up->u_groupv)) { @@ -1197,7 +1197,7 @@ adduser(char *login_name, user_t *up) pw_abort(); err(EXIT_FAILURE, "pw_mkdb failed"); } - syslog(LOG_INFO, "new user added: name=%s, uid=%d, gid=%d, home=%s, shell=%s", + syslog(LOG_INFO, "new user added: name=%s, uid=%u, gid=%u, home=%s, shell=%s", login_name, up->u_uid, gid, home, up->u_shell); return 1; } @@ -1559,7 +1559,7 @@ moduser(char *login_name, char *newlogin, user_t *up) if (strncmp(login_name, buf, loginc) == 0 && loginc == colonc) { if (up != NULL) { if ((len = snprintf(buf, sizeof(buf), - "%s:%s:%d:%d:%s:%ld:%ld:%s:%s:%s\n", + "%s:%s:%u:%u:%s:%ld:%ld:%s:%s:%s\n", newlogin, pwp->pw_passwd, pwp->pw_uid, @@ -1644,10 +1644,10 @@ moduser(char *login_name, char *newlogin, user_t *up) if (up == NULL) { syslog(LOG_INFO, "user removed: name=%s", login_name); } else if (strcmp(login_name, newlogin) == 0) { - syslog(LOG_INFO, "user information modified: name=%s, uid=%d, gid=%d, home=%s, shell=%s", + syslog(LOG_INFO, "user information modified: name=%s, uid=%u, gid=%u, home=%s, shell=%s", login_name, pwp->pw_uid, pwp->pw_gid, pwp->pw_dir, pwp->pw_shell); } else { - syslog(LOG_INFO, "user information modified: name=%s, new name=%s, uid=%d, gid=%d, home=%s, shell=%s", + syslog(LOG_INFO, "user information modified: name=%s, new name=%s, uid=%u, gid=%u, home=%s, shell=%s", login_name, newlogin, pwp->pw_uid, pwp->pw_gid, pwp->pw_dir, pwp->pw_shell); } return 1; @@ -1847,7 +1847,7 @@ useradd(int argc, char **argv) (void) printf("inactive\t%s\n", (u.u_inactive == NULL) ? UNSET_INACTIVE : u.u_inactive); (void) printf("expire\t\t%s\n", (u.u_expire == NULL) ? UNSET_EXPIRY : u.u_expire); for (i = 0 ; i < u.u_rc ; i++) { - (void) printf("range\t\t%d..%d\n", u.u_rv[i].r_from, u.u_rv[i].r_to); + (void) printf("range\t\t%u..%u\n", u.u_rv[i].r_from, u.u_rv[i].r_to); } return EXIT_SUCCESS; } |