libc get{pw,gr}* names.
__unused static const char rcsid[] = "$Sudo$";
#endif /* lint */
-#ifdef MYPW
-extern void (*my_setgrent) __P((void));
-extern void (*my_endgrent) __P((void));
-extern struct group *(*my_getgrnam) __P((const char *));
-extern struct group *(*my_getgrgid) __P((gid_t));
-#define setgrent() my_setgrent()
-#define endgrent() my_endgrent()
-#define getgrnam(n) my_getgrnam(n)
-#define getgrgid(g) my_getgrgid(g)
-
-extern void (*my_setpwent) __P((void));
-extern void (*my_endpwent) __P((void));
-extern struct passwd *(*my_getpwnam) __P((const char *));
-extern struct passwd *(*my_getpwuid) __P((uid_t));
-#define setpwent() my_setpwent()
-#define endpwent() my_endpwent()
-#define getpwnam(n) my_getpwnam(n)
-#define getpwuid(u) my_getpwuid(u)
-#endif
-
/*
* The passwd and group caches.
*/
struct passwd *list_pw;
extern int parse_error;
-/* passwd/group redirection for pwutil.c */
-void (*my_setgrent) __P((void)) = setgrent;
-void (*my_endgrent) __P((void)) = endgrent;
-struct group *(*my_getgrnam) __P((const char *)) = getgrnam;
-struct group *(*my_getgrgid) __P((gid_t)) = getgrgid;
-void (*my_setpwent) __P((void)) = setpwent;
-void (*my_endpwent) __P((void)) = endpwent;
-struct passwd *(*my_getpwnam) __P((const char *)) = getpwnam;
-struct passwd *(*my_getpwuid) __P((uid_t)) = getpwuid;
-
/* For getopt(3) */
extern char *optarg;
extern int optind;
void set_runasgr __P((char *));
void set_runaspw __P((char *));
-extern void ts_setgrfile __P((const char *));
-extern void ts_setgrent __P((void));
-extern void ts_endgrent __P((void));
-extern struct group *ts_getgrent __P((void));
-extern struct group *ts_getgrnam __P((const char *));
-extern struct group *ts_getgrgid __P((gid_t));
-extern void ts_setpwfile __P((const char *));
-extern void ts_setpwent __P((void));
-extern void ts_endpwent __P((void));
-extern struct passwd *ts_getpwent __P((void));
-extern struct passwd *ts_getpwnam __P((const char *));
-extern struct passwd *ts_getpwuid __P((uid_t));
+extern void setgrfile __P((const char *));
+extern void setgrent __P((void));
+extern void endgrent __P((void));
+extern struct group *getgrent __P((void));
+extern struct group *getgrnam __P((const char *));
+extern struct group *getgrgid __P((gid_t));
+extern void setpwfile __P((const char *));
+extern void setpwent __P((void));
+extern void endpwent __P((void));
+extern struct passwd *getpwent __P((void));
+extern struct passwd *getpwnam __P((const char *));
+extern struct passwd *getpwuid __P((uid_t));
int
main(argc, argv)
NewArgv = argv;
/* Set group/passwd file and init the cache. */
- if (grfile) {
- my_setgrent = ts_setgrent;
- my_endgrent = ts_endgrent;
- my_getgrnam = ts_getgrnam;
- my_getgrgid = ts_getgrgid;
- ts_setgrfile(grfile);
- }
- if (pwfile) {
- my_setpwent = ts_setpwent;
- my_endpwent = ts_endpwent;
- my_getpwnam = ts_getpwnam;
- my_getpwuid = ts_getpwuid;
- ts_setpwfile(pwfile);
- }
+ if (grfile)
+ setgrfile(grfile);
+ if (pwfile)
+ setpwfile(pwfile);
sudo_setpwent();
sudo_setgrent();
static const char *grfile = "/etc/group";
static int gr_stayopen;
-void ts_setgrfile __P((const char *));
-void ts_setgrent __P((void));
-void ts_endgrent __P((void));
-struct group *ts_getgrent __P((void));
-struct group *ts_getgrnam __P((const char *));
-struct group *ts_getgrgid __P((gid_t));
+void setgrfile __P((const char *));
+void setgrent __P((void));
+void endgrent __P((void));
+struct group *getgrent __P((void));
+struct group *getgrnam __P((const char *));
+struct group *getgrgid __P((gid_t));
-void ts_setpwfile __P((const char *));
-void ts_setpwent __P((void));
-void ts_endpwent __P((void));
-struct passwd *ts_getpwent __P((void));
-struct passwd *ts_getpwnam __P((const char *));
-struct passwd *ts_getpwuid __P((uid_t));
+void setpwfile __P((const char *));
+void setpwent __P((void));
+void endpwent __P((void));
+struct passwd *getpwent __P((void));
+struct passwd *getpwnam __P((const char *));
+struct passwd *getpwuid __P((uid_t));
void
-ts_setpwfile(file)
+setpwfile(file)
const char *file;
{
pwfile = file;
if (pwf != NULL)
- ts_endpwent();
+ endpwent();
}
void
-ts_setpwent()
+setpwent()
{
if (pwf == NULL)
pwf = fopen(pwfile, "r");
}
void
-ts_endpwent()
+endpwent()
{
if (pwf != NULL) {
fclose(pwf);
}
struct passwd *
-ts_getpwent()
+getpwent()
{
static struct passwd pw;
static char pwbuf[LINE_MAX];
}
struct passwd *
-ts_getpwnam(name)
+getpwnam(name)
const char *name;
{
struct passwd *pw;
rewind(pwf);
else if ((pwf = fopen(pwfile, "r")) == NULL)
return(NULL);
- while ((pw = ts_getpwent()) != NULL) {
+ while ((pw = getpwent()) != NULL) {
if (strcmp(pw->pw_name, name) == 0)
break;
}
}
struct passwd *
-ts_getpwuid(uid)
+getpwuid(uid)
uid_t uid;
{
struct passwd *pw;
rewind(pwf);
else if ((pwf = fopen(pwfile, "r")) == NULL)
return(NULL);
- while ((pw = ts_getpwent()) != NULL) {
+ while ((pw = getpwent()) != NULL) {
if (pw->pw_uid == uid)
break;
}
}
void
-ts_setgrfile(file)
+setgrfile(file)
const char *file;
{
grfile = file;
if (grf != NULL)
- ts_endgrent();
+ endgrent();
}
void
-ts_setgrent()
+setgrent()
{
if (grf == NULL)
grf = fopen(grfile, "r");
}
void
-ts_endgrent()
+endgrent()
{
if (grf != NULL) {
fclose(grf);
}
struct group *
-ts_getgrent()
+getgrent()
{
static struct group gr;
static char grbuf[LINE_MAX], *gr_mem[GRMEM_MAX+1];
}
struct group *
-ts_getgrnam(name)
+getgrnam(name)
const char *name;
{
struct group *gr;
rewind(grf);
else if ((grf = fopen(grfile, "r")) == NULL)
return(NULL);
- while ((gr = ts_getgrent()) != NULL) {
+ while ((gr = getgrent()) != NULL) {
if (strcmp(gr->gr_name, name) == 0)
break;
}
}
struct group *
-ts_getgrgid(gid)
+getgrgid(gid)
gid_t gid;
{
struct group *gr;
rewind(grf);
else if ((grf = fopen(grfile, "r")) == NULL)
return(NULL);
- while ((gr = ts_getgrent()) != NULL) {
+ while ((gr = getgrent()) != NULL) {
if (gr->gr_gid == gid)
break;
}