diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-08-06 20:41:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-08-06 20:41:09 +0000 |
commit | abdab9264887b198168dac150a9bbff44a774868 (patch) | |
tree | 26c311697fe239df4698e550f705fd8ef5a9a932 /usr.sbin | |
parent | cde63a0b937f284da8b2903ae196fc5bfb998ea8 (diff) |
uid_t and gid_t, and use %u
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/cron/misc.c | 4 | ||||
-rw-r--r-- | usr.sbin/pppd/auth.c | 6 | ||||
-rw-r--r-- | usr.sbin/pppd/main.c | 8 | ||||
-rw-r--r-- | usr.sbin/quot/quot.c | 7 | ||||
-rw-r--r-- | usr.sbin/sa/extern.h | 6 | ||||
-rw-r--r-- | usr.sbin/sa/usrdb.c | 14 | ||||
-rw-r--r-- | usr.sbin/sliplogin/sliplogin.c | 4 |
7 files changed, 25 insertions, 24 deletions
diff --git a/usr.sbin/cron/misc.c b/usr.sbin/cron/misc.c index b0a6bafdf07..fde97da8e70 100644 --- a/usr.sbin/cron/misc.c +++ b/usr.sbin/cron/misc.c @@ -16,7 +16,7 @@ */ #if !defined(lint) && !defined(LINT) -static char rcsid[] = "$Id: misc.c,v 1.5 1998/07/10 08:06:34 deraadt Exp $"; +static char rcsid[] = "$Id: misc.c,v 1.6 1999/08/06 20:41:07 deraadt Exp $"; #endif /* vix 26jan87 [RCS has the rest of the log] @@ -667,7 +667,7 @@ arpadate(clock) #ifdef HAVE_SAVED_UIDS -static int save_euid; +static uid_t save_euid; int swap_uids() { save_euid = geteuid(); return seteuid(getuid()); } int swap_uids_back() { return seteuid(save_euid); } #else /*HAVE_SAVED_UIDS*/ diff --git a/usr.sbin/pppd/auth.c b/usr.sbin/pppd/auth.c index f779896bf73..50de16d37f0 100644 --- a/usr.sbin/pppd/auth.c +++ b/usr.sbin/pppd/auth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auth.c,v 1.15 1998/05/08 04:52:18 millert Exp $ */ +/* $OpenBSD: auth.c,v 1.16 1999/08/06 20:41:07 deraadt Exp $ */ /* * auth.c - PPP authentication and phase control. @@ -38,7 +38,7 @@ #if 0 static char rcsid[] = "Id: auth.c,v 1.37 1998/03/26 04:46:03 paulus Exp $"; #else -static char rcsid[] = "$OpenBSD: auth.c,v 1.15 1998/05/08 04:52:18 millert Exp $"; +static char rcsid[] = "$OpenBSD: auth.c,v 1.16 1999/08/06 20:41:07 deraadt Exp $"; #endif #endif @@ -1491,7 +1491,7 @@ auth_script(script) if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL) user_name = pw->pw_name; else { - sprintf(struid, "%d", getuid()); + sprintf(struid, "%u", getuid()); user_name = struid; } sprintf(strspeed, "%d", baud_rate); diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c index d183e6b0474..6472fff0893 100644 --- a/usr.sbin/pppd/main.c +++ b/usr.sbin/pppd/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.26 1999/05/03 21:38:08 mickey Exp $ */ +/* $OpenBSD: main.c,v 1.27 1999/08/06 20:41:07 deraadt Exp $ */ /* * main.c - Point-to-Point Protocol main module @@ -23,7 +23,7 @@ #if 0 static char rcsid[] = "Id: main.c,v 1.49 1998/05/05 05:24:17 paulus Exp $"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.26 1999/05/03 21:38:08 mickey Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.27 1999/08/06 20:41:07 deraadt Exp $"; #endif #endif @@ -204,7 +204,7 @@ main(argc, argv) uid = getuid(); privileged = uid == 0; - sprintf(numbuf, "%d", uid); + sprintf(numbuf, "%u", uid); script_setenv("UID", numbuf); /* @@ -288,7 +288,7 @@ main(argc, argv) else p = "(unknown)"; } - syslog(LOG_NOTICE, "pppd %s.%d%s started by %s, uid %d", + syslog(LOG_NOTICE, "pppd %s.%d%s started by %s, uid %u", VERSION, PATCHLEVEL, IMPLEMENTATION, p, uid); /* diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index cc5857abded..5229b7024f5 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: quot.c,v 1.5 1998/07/08 19:43:23 millert Exp $ */ +/* $OpenBSD: quot.c,v 1.6 1999/08/06 20:41:08 deraadt Exp $ */ /* $NetBSD: quot.c,v 1.7.4.1 1996/05/31 18:06:36 jtc Exp $ */ /* @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: quot.c,v 1.5 1998/07/08 19:43:23 millert Exp $"; +static char rcsid[] = "$Id: quot.c,v 1.6 1999/08/06 20:41:08 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -244,7 +244,8 @@ user(uid) if (!(pwd = getpwuid(uid))) { if (usr->name = (char *)malloc(7)) - sprintf(usr->name, "#%d", uid); + sprintf(usr->name, "#%u", + uid); } else { if (usr->name = (char *) malloc(strlen(pwd->pw_name) + 1)) diff --git a/usr.sbin/sa/extern.h b/usr.sbin/sa/extern.h index 05feee85b18..144b00db847 100644 --- a/usr.sbin/sa/extern.h +++ b/usr.sbin/sa/extern.h @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: extern.h,v 1.1 1995/10/18 08:48:07 deraadt Exp $ + * $Id: extern.h,v 1.2 1999/08/06 20:41:08 deraadt Exp $ */ #include <sys/types.h> @@ -38,7 +38,7 @@ struct cmdinfo { char ci_comm[MAXCOMLEN+2]; /* command name (+ '*') */ - u_long ci_uid; /* user id */ + uid_t ci_uid; /* user id */ u_quad_t ci_calls; /* number of calls */ u_quad_t ci_etime; /* elapsed time */ u_quad_t ci_utime; /* user time */ @@ -50,7 +50,7 @@ struct cmdinfo { #define CI_UNPRINTABLE 0x0001 /* unprintable chars in name */ struct userinfo { - u_long ui_uid; /* user id; for consistency */ + uid_t ui_uid; /* user id; for consistency */ u_quad_t ui_calls; /* number of invocations */ u_quad_t ui_utime; /* user time */ u_quad_t ui_stime; /* system time */ diff --git a/usr.sbin/sa/usrdb.c b/usr.sbin/sa/usrdb.c index 2ca1737dec9..656f5eb493a 100644 --- a/usr.sbin/sa/usrdb.c +++ b/usr.sbin/sa/usrdb.c @@ -29,7 +29,7 @@ */ #ifndef LINT -static char rcsid[] = "$Id: usrdb.c,v 1.1 1995/10/18 08:48:07 deraadt Exp $"; +static char rcsid[] = "$Id: usrdb.c,v 1.2 1999/08/06 20:41:08 deraadt Exp $"; #endif #include <sys/types.h> @@ -121,7 +121,7 @@ usracct_add(ci) { DBT key, data; struct userinfo newui; - u_long uid; + uid_t uid; int rv; uid = ci->ci_uid; @@ -130,13 +130,13 @@ usracct_add(ci) rv = DB_GET(usracct_db, &key, &data, 0); if (rv < 0) { - warn("get key %d from user accounting stats", uid); + warn("get key %u from user accounting stats", uid); return (-1); } else if (rv == 0) { /* it's there; copy whole thing */ /* add the old data to the new data */ memcpy(&newui, data.data, data.size); if (newui.ui_uid != uid) { - warnx("key %d != expected record number %d", + warnx("key %u != expected record number %u", newui.ui_uid, uid); warnx("inconsistent user accounting stats"); return (-1); @@ -156,7 +156,7 @@ usracct_add(ci) data.size = sizeof(newui); rv = DB_PUT(usracct_db, &key, &data, 0); if (rv < 0) { - warn("add key %d to user accounting stats", uid); + warn("add key %u to user accounting stats", uid); return (-1); } else if (rv != 0) { warnx("DB_PUT returned 1"); @@ -172,7 +172,7 @@ usracct_update() DB *saved_usracct_db; DBT key, data; BTREEINFO bti; - u_long uid; + uid_t uid; int error, serr, nerr; memset(&bti, 0, sizeof(bti)); @@ -253,7 +253,7 @@ usracct_print() /* t is always >= 0.0001; see above */ if (kflag) - printf("%12qu%s", ui->ui_mem / t, "k"); + printf("%12.0f%s", ui->ui_mem / t, "k"); else printf("%12qu%s", ui->ui_mem, "k*sec"); diff --git a/usr.sbin/sliplogin/sliplogin.c b/usr.sbin/sliplogin/sliplogin.c index 28df561dc30..8ea9f33a60d 100644 --- a/usr.sbin/sliplogin/sliplogin.c +++ b/usr.sbin/sliplogin/sliplogin.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)sliplogin.c 5.6 (Berkeley) 3/2/91";*/ -static char rcsid[] = "$Id: sliplogin.c,v 1.10 1999/04/28 17:52:44 deraadt Exp $"; +static char rcsid[] = "$Id: sliplogin.c,v 1.11 1999/08/06 20:41:08 deraadt Exp $"; #endif /* not lint */ /* @@ -104,7 +104,7 @@ static char *restricted_environ[] = { int unit; int speed; -int uid; +uid_t uid; char loginargs[BUFSIZ]; char loginfile[MAXPATHLEN]; char loginname[BUFSIZ]; |