home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
3
/
3378
< prev
next >
Wrap
Internet Message Format
|
1991-05-20
|
3KB
From: jfh@rpp386.cactus.org (John F Haugh II)
Newsgroups: alt.sources
Subject: shadow login suite, patch 1
Message-ID: <19316@rpp386.cactus.org>
Date: 20 May 91 12:40:02 GMT
The kit I posted last week was missing the id.c file. This patch
includes the id.c file and the change to the Makefile to include
it in the list of files to wrap.
--
*** /dev/null Sun May 19 18:13:11 1991
--- id.c Sun May 19 18:25:52 1991
***************
*** 0 ****
--- 1,62 ----
+ /*
+ * id - print current process user identification information
+ *
+ * This program was written by John F. Haugh II (jfh@rpp386.UUCP)
+ * on 7/9/89 and placed into the public domain.
+ *
+ * Syntax:
+ * id
+ * Synopsis:
+ * Print the current process identifiers. This includes the
+ * UID, GID, effective-UID and effective-GID.
+ *
+ * Notes:
+ * Straightforward implementation. Get the IDs and print
+ * them out. This is being included as a means of exercising
+ * the low level user database routines.
+ */
+
+ #include <sys/types.h>
+ #include <stdio.h>
+ #include <grp.h>
+ #include "pwd.h"
+
+ #ifndef lint
+ static char sccsid[] = "@(#)id.c 3.1 12:30:47 12/12/90";
+ #endif
+
+ main (argc, argv)
+ int argc;
+ char **argv;
+ {
+ int id;
+ int i;
+ struct passwd *pw,
+ *getpwuid();
+ struct group *gr,
+ *getgrgid();
+
+ if (pw = getpwuid (id = getuid ()))
+ printf ("uid=%d(%s)", id, pw->pw_name);
+ else
+ printf ("uid=%d", id);
+
+ if (gr = getgrgid (id = getgid ()))
+ printf (" gid=%d(%s)", id, gr->gr_name);
+ else
+ printf (" gid=%d", id);
+
+ if (getuid () != geteuid ()) {
+ if (pw = getpwuid (id = geteuid ()))
+ printf (" euid=%d(%s)", id, pw->pw_name);
+ else
+ printf (" euid=%d", id);
+ }
+ if (getgid () != getegid ()) {
+ if (gr = getgrgid (id = getegid ()))
+ printf (" egid=%d(%s)", id, gr->gr_name);
+ else
+ printf (" egid=%d", id);
+ }
+ putchar ('\n');
+ }
*** Standard Input Wed Dec 31 18:00:00 1969
--- Makefile Sun May 19 18:27:07 1991
***************
*** 8,16 ****
# and conspicuously displayed on all copies of object code or
# distribution media.
#
! # %W% %U% - Shadow password system
#
! # %W% %U% %G%
#
SHELL = /bin/sh
--- 8,16 ----
# and conspicuously displayed on all copies of object code or
# distribution media.
#
! # @(#)Makefile 3.8 18:25:18 - Shadow password system
#
! # @(#)Makefile 3.8 18:25:18 5/19/91
#
SHELL = /bin/sh
***************
*** 129,135 ****
newusers.c groupio.c fields.c pwdbm.c grpack.c grdbm.c sppack.c \
spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c
! FILES1 = README newgrp.c Makefile config.h pwunconv.c obscure.c age.c
FILES2 = passwd.c port.c lmain.c mkpasswd.c sulogin.c pwpack.c dialup.c \
sulog.c getpass.c
--- 129,135 ----
newusers.c groupio.c fields.c pwdbm.c grpack.c grdbm.c sppack.c \
spdbm.c dpmain.c gshadow.c gsdbm.c gspack.c sgroupio.c
! FILES1 = README newgrp.c Makefile config.h pwunconv.c obscure.c age.c id.c
FILES2 = passwd.c port.c lmain.c mkpasswd.c sulogin.c pwpack.c dialup.c \
sulog.c getpass.c
--
John F. Haugh II | Distribution to | UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 255-8251 | GEnie PROHIBITED :-) | Domain: jfh@rpp386.cactus.org
"If liberals interpreted the 2nd Amendment the same way they interpret the
rest of the Constitution, gun ownership would be mandatory."