Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153507438
D47869.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D47869.diff
View Options
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c
--- a/libexec/comsat/comsat.c
+++ b/libexec/comsat/comsat.c
@@ -59,7 +59,7 @@
static char hostname[MAXHOSTNAMELEN];
-static void jkfprintf(FILE *, char[], char[], off_t);
+static void jkfprintf(FILE *, char[], off_t);
static void mailfor(char *);
static void notify(struct utmpx *, char[], off_t, int);
static void reapchildren(int);
@@ -147,6 +147,7 @@
FILE *tp;
struct stat stb;
struct termios tio;
+ struct passwd *p;
char tty[20];
const char *s = utp->ut_line;
@@ -180,6 +181,14 @@
}
(void)tcgetattr(fileno(tp), &tio);
cr = ((tio.c_oflag & (OPOST|ONLCR)) == (OPOST|ONLCR)) ? "\n" : "\n\r";
+
+ /* Set uid/gid/groups to user's in case mail drop is on nfs */
+ if ((p = getpwnam(utp->ut_user)) == NULL ||
+ initgroups(p->pw_name, p->pw_gid) == -1 ||
+ setgid(p->pw_gid) == -1 ||
+ setuid(p->pw_uid) == -1)
+ return;
+
switch (stb.st_mode & (S_IXUSR | S_IXGRP)) {
case S_IXUSR:
case (S_IXUSR | S_IXGRP):
@@ -188,7 +197,7 @@
cr, utp->ut_user, (int)sizeof(hostname), hostname,
folder ? cr : "", folder ? "to " : "", folder ? file : "",
cr, cr);
- jkfprintf(tp, utp->ut_user, file, offset);
+ jkfprintf(tp, file, offset);
break;
case S_IXGRP:
(void)fprintf(tp, "\007");
@@ -204,21 +213,13 @@
}
static void
-jkfprintf(FILE *tp, char user[], char file[], off_t offset)
+jkfprintf(FILE *tp, char file[], off_t offset)
{
unsigned char *cp, ch;
FILE *fi;
int linecnt, charcnt, inheader;
- struct passwd *p;
unsigned char line[BUFSIZ];
- /* Set uid/gid/groups to user's in case mail drop is on nfs */
- if ((p = getpwnam(user)) == NULL ||
- initgroups(p->pw_name, p->pw_gid) == -1 ||
- setgid(p->pw_gid) == -1 ||
- setuid(p->pw_uid) == -1)
- return;
-
if ((fi = fopen(file, "r")) == NULL)
return;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 12:47 PM (9 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31979989
Default Alt Text
D47869.diff (1 KB)
Attached To
Mode
D47869: comsat: move uid/gid setting earlier
Attached
Detach File
Event Timeline
Log In to Comment