From 73f6f1368316c6c85c8a506f8db5bc26ba8446dc Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 28 Aug 2000 03:50:55 +0000 Subject: print uid/gid as unsigned --- usr.bin/ssh/auth-krb4.c | 4 ++-- usr.bin/ssh/session.c | 4 ++-- usr.bin/ssh/ssh-add.c | 5 +++-- usr.bin/ssh/sshconnect.c | 8 ++++---- usr.bin/ssh/uidswap.c | 12 ++++++------ 5 files changed, 17 insertions(+), 16 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/ssh/auth-krb4.c b/usr.bin/ssh/auth-krb4.c index ae2b2a3d892..8715dc0d978 100644 --- a/usr.bin/ssh/auth-krb4.c +++ b/usr.bin/ssh/auth-krb4.c @@ -9,7 +9,7 @@ #include "ssh.h" #include "servconf.h" -RCSID("$OpenBSD: auth-krb4.c,v 1.16 2000/08/02 17:27:04 provos Exp $"); +RCSID("$OpenBSD: auth-krb4.c,v 1.17 2000/08/28 03:50:54 deraadt Exp $"); #ifdef KRB4 char *ticket = NULL; @@ -154,7 +154,7 @@ krb4_init(uid_t uid) if (lstat("/ticket", &st) != -1) tkt_root = "/ticket/"; #endif /* AFS */ - snprintf(ticket, MAXPATHLEN, "%s%d_%d", tkt_root, uid, getpid()); + snprintf(ticket, MAXPATHLEN, "%s%u_%d", tkt_root, uid, getpid()); (void) krb_set_tkt_string(ticket); } /* Register ticket cleanup in case of fatal error. */ diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c index 1d821c3b8a3..2c9a50fa741 100644 --- a/usr.bin/ssh/session.c +++ b/usr.bin/ssh/session.c @@ -8,7 +8,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.30 2000/08/25 16:10:05 deraadt Exp $"); +RCSID("$OpenBSD: session.c,v 1.31 2000/08/28 03:50:54 deraadt Exp $"); #include "xmalloc.h" #include "ssh.h" @@ -811,7 +811,7 @@ do_child(const char *command, struct passwd * pw, const char *term, #endif } if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) - fatal("Failed to set uids to %d.", (int) pw->pw_uid); + fatal("Failed to set uids to %u.", (u_int) pw->pw_uid); } /* * Get the shell from the password data. An empty shell field is diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c index ae5ca90d2fd..48053739b66 100644 --- a/usr.bin/ssh/ssh-add.c +++ b/usr.bin/ssh/ssh-add.c @@ -10,7 +10,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-add.c,v 1.19 2000/08/19 21:34:43 markus Exp $"); +RCSID("$OpenBSD: ssh-add.c,v 1.20 2000/08/28 03:50:54 deraadt Exp $"); #include #include @@ -254,7 +254,8 @@ main(int argc, char **argv) if (no_files) { pw = getpwuid(getuid()); if (!pw) { - fprintf(stderr, "No user found with uid %d\n", (int) getuid()); + fprintf(stderr, "No user found with uid %u\n", + (u_int)getuid()); ssh_close_authentication_connection(ac); exit(1); } diff --git a/usr.bin/ssh/sshconnect.c b/usr.bin/ssh/sshconnect.c index ea4dfde2fa2..f16e4e6f601 100644 --- a/usr.bin/ssh/sshconnect.c +++ b/usr.bin/ssh/sshconnect.c @@ -8,7 +8,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.76 2000/06/17 20:30:10 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.77 2000/08/28 03:50:54 deraadt Exp $"); #include #include @@ -189,8 +189,8 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, int gaierr; struct linger linger; - debug("ssh_connect: getuid %d geteuid %d anon %d", - (int) getuid(), (int) geteuid(), anonymous); + debug("ssh_connect: getuid %u geteuid %u anon %d", + (u_int) getuid(), (u_int) geteuid(), anonymous); /* Get default port if port has not been set. */ if (port == 0) { @@ -661,7 +661,7 @@ ssh_login(int host_key_valid, RSA *own_host_key, const char *orighost, /* Get local user name. Use it as server user if no user name was given. */ pw = getpwuid(original_real_uid); if (!pw) - fatal("User id %d not found from user database.", original_real_uid); + fatal("User id %u not found from user database.", original_real_uid); local_user = xstrdup(pw->pw_name); server_user = options.user ? options.user : local_user; diff --git a/usr.bin/ssh/uidswap.c b/usr.bin/ssh/uidswap.c index 21ca46d5eff..69527ed0dba 100644 --- a/usr.bin/ssh/uidswap.c +++ b/usr.bin/ssh/uidswap.c @@ -7,7 +7,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: uidswap.c,v 1.7 2000/06/20 01:39:45 markus Exp $"); +RCSID("$OpenBSD: uidswap.c,v 1.8 2000/08/28 03:50:54 deraadt Exp $"); #include "ssh.h" #include "uidswap.h" @@ -43,15 +43,15 @@ temporarily_use_uid(uid_t uid) /* Set the effective uid to the given (unprivileged) uid. */ if (seteuid(uid) == -1) - debug("seteuid %d: %.100s", (int) uid, strerror(errno)); + debug("seteuid %u: %.100s", (u_int) uid, strerror(errno)); #else /* SAVED_IDS_WORK_WITH_SETUID */ /* Propagate the privileged uid to all of our uids. */ if (setuid(geteuid()) < 0) - debug("setuid %d: %.100s", (int) geteuid(), strerror(errno)); + debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno)); /* Set the effective uid to the given (unprivileged) uid. */ if (seteuid(uid) == -1) - debug("seteuid %d: %.100s", (int) uid, strerror(errno)); + debug("seteuid %u: %.100s", (u_int) uid, strerror(errno)); #endif /* SAVED_IDS_WORK_WITH_SETEUID */ } @@ -64,7 +64,7 @@ restore_uid() #ifdef SAVED_IDS_WORK_WITH_SETEUID /* Set the effective uid back to the saved uid. */ if (seteuid(saved_euid) < 0) - debug("seteuid %d: %.100s", (int) saved_euid, strerror(errno)); + debug("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); #else /* SAVED_IDS_WORK_WITH_SETEUID */ /* * We are unable to restore the real uid to its unprivileged value. @@ -83,5 +83,5 @@ void permanently_set_uid(uid_t uid) { if (setuid(uid) < 0) - debug("setuid %d: %.100s", (int) uid, strerror(errno)); + debug("setuid %u: %.100s", (u_int) uid, strerror(errno)); } -- cgit v1.2.3