Handle UID/GID and attribute warning paths in connect, ncpserv and related files
This commit is contained in:
@@ -197,9 +197,9 @@ static int new_dir_handle(struct stat *stb, NW_PATH *nwpath)
|
||||
if ( ( !(dh->no_search_trustee=tru_eff_rights_exists(nwpath->volume, dh->unixname, stb, TRUSTEE_F)))
|
||||
|| (dh->no_search_trustee & TRUSTEE_T) ) {
|
||||
if ((dh->f=opendir(dh->unixname)) == (DIR*)NULL) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
dh->f=opendir(dh->unixname);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ static int free_dir_handle(int dhandle)
|
||||
|
||||
void set_default_guid(void)
|
||||
{
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
setgroups(0, NULL);
|
||||
if (setegid(default_gid) < 0 || seteuid(default_uid) < 0) {
|
||||
errorp(1, "set_default_guid, !! SecurityAbort !!",
|
||||
@@ -272,7 +272,7 @@ void set_guid(int gid, int uid)
|
||||
} else if (act_gid != gid || act_uid != uid) {
|
||||
struct passwd *pw = getpwuid(uid);
|
||||
if (NULL != pw) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
initgroups(pw->pw_name, gid);
|
||||
}
|
||||
act_gid = gid;
|
||||
@@ -288,7 +288,7 @@ void set_guid(int gid, int uid)
|
||||
int k=getgroups(0, NULL);
|
||||
if (k > 0) {
|
||||
act_grouplist=(gid_t*)xmalloc((k+1) * sizeof(gid_t));
|
||||
getgroups(k, act_grouplist+1);
|
||||
if (getgroups(k, act_grouplist+1) < 0) {}
|
||||
*act_grouplist=(gid_t)k;
|
||||
}
|
||||
}
|
||||
@@ -340,8 +340,8 @@ int get_unix_access_rights(struct stat *stb, uint8 *unixname)
|
||||
euid=geteuid();
|
||||
rgid=getgid();
|
||||
|
||||
setreuid(act_uid,0);
|
||||
setgid(act_gid);
|
||||
if (setreuid(act_uid,0)) {}
|
||||
if (setgid(act_gid)) {}
|
||||
|
||||
if (!access(unixname, F_OK)) {
|
||||
|
||||
@@ -355,8 +355,9 @@ int get_unix_access_rights(struct stat *stb, uint8 *unixname)
|
||||
|
||||
/* mode |= get_unix_eff_rights(stb) & ~(R_OK|W_OK|X_OK); */
|
||||
}
|
||||
setgid(rgid);
|
||||
setreuid(ruid, euid);
|
||||
if (setgid(rgid)) {}
|
||||
if (setreuid(ruid, euid)) {}
|
||||
|
||||
|
||||
return(mode);
|
||||
}
|
||||
@@ -582,9 +583,9 @@ static int func_search_entry(NW_PATH *nwpath, int attrib,
|
||||
if ( (!stat(xkpath, &(fs->statb)))
|
||||
&& !tru_eff_rights_exists(volume, xkpath, &(fs->statb), TRUSTEE_F)) {
|
||||
if ((f=opendir(xkpath)) == (DIR*)NULL) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
f=opendir(xkpath);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -653,9 +654,9 @@ static int get_dir_entry(NW_PATH *nwpath,
|
||||
&& ( (!(no_search_trustee = tru_eff_rights_exists(volume, xkpath, statb, TRUSTEE_F)))
|
||||
|| (no_search_trustee&TRUSTEE_T)) ) {
|
||||
if ((f=opendir(xkpath)) == (DIR*)NULL) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
f=opendir(xkpath);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,9 +717,9 @@ static DIR *give_dh_f(DIR_HANDLE *dh)
|
||||
{
|
||||
if (!dh->f) {
|
||||
*(dh->kpath) = '\0';
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
dh->f = opendir(dh->unixname);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
dh->timestamp=time(NULL); /* tnx to Andrew Sapozhnikov */
|
||||
return(dh->f);
|
||||
@@ -1315,12 +1316,12 @@ static int do_mv_file(NW_PATH *nwpath, FUNC_SEARCH *fs)
|
||||
/* now restore destpath.fn */
|
||||
xstrcpy(nws->destpath.fn, saved_fn);
|
||||
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
if (entry8_flags & 0x4) /* new: 20-Nov-96 */
|
||||
result = unx_mvfile_or_dir(unsource, undest);
|
||||
else
|
||||
result = unx_mvfile(unsource, undest);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
|
||||
switch (result) {
|
||||
case 0 : break; /* ok */
|
||||
@@ -1457,12 +1458,12 @@ int mv_file(int qdirhandle, uint8 *q, int qlen,
|
||||
char unziel[256];
|
||||
xstrcpy(unziel, build_unix_name(&zielpath,0));
|
||||
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
if (entry8_flags & 0x4) /* new: 20-Nov-96 */
|
||||
completition = unx_mvfile_or_dir(qfn, unziel);
|
||||
else
|
||||
completition = unx_mvfile(qfn, unziel);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
|
||||
switch (completition) {
|
||||
case 0 : break;
|
||||
@@ -1497,10 +1498,10 @@ static int do_set_file_info(NW_PATH *nwpath, FUNC_SEARCH *fs)
|
||||
result=set_nw_attrib_word(nwpath->volume, unname, &statb,
|
||||
(int)GET_16(f->attrib));
|
||||
if (!result) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
if (utime(unname, &ut))
|
||||
result= (-0x8c); /* no modify rights */
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
}
|
||||
XDPRINTF((5,0,"set_file_info result=0x%x, unname:%s:", unname, -result));
|
||||
@@ -1600,9 +1601,9 @@ int nw_unlink_node(int volume, uint8 *unname, struct stat *stb)
|
||||
free_dir_stuff(stb, 0);
|
||||
result=nw_rmdir(unname);
|
||||
if (result==-0x8a){ /* no privilegs */
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
result=nw_rmdir(unname);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
if (!result)
|
||||
free_dir_stuff(stb, 1);
|
||||
@@ -1614,9 +1615,9 @@ int nw_unlink_node(int volume, uint8 *unname, struct stat *stb)
|
||||
-1 == share_file(stb->st_dev, stb->st_ino, 0x10f, 2))
|
||||
return(-0x8a); /* NO Delete Privileges, file is open */
|
||||
if (0 != (result=unlink(unname))){
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
result=unlink(unname) ? -0x8a : 0;
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
}
|
||||
if (!result) {
|
||||
@@ -1652,10 +1653,10 @@ int nw_creat_node(int volume, uint8 *unname, int mode)
|
||||
if (!tru_eff_rights_exists(volume, path, &stb, TRUSTEE_C)){
|
||||
result=mkdir(unname, 0777);
|
||||
if (result) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
if (0==(result=mkdir(unname, 0755)))
|
||||
chown(unname, act_uid, act_gid);
|
||||
reseteuid();
|
||||
if (chown(unname, act_uid, act_gid)) {}
|
||||
(void)reseteuid();
|
||||
}
|
||||
if (result)
|
||||
result=-0xff;
|
||||
@@ -1665,9 +1666,9 @@ int nw_creat_node(int volume, uint8 *unname, int mode)
|
||||
if (umode_dir) {
|
||||
if (umode_dir == -1) /* we get parent dir */
|
||||
umode_dir=stb.st_mode;
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
chmod(unname, umode_dir);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
@@ -1676,9 +1677,9 @@ int nw_creat_node(int volume, uint8 *unname, int mode)
|
||||
struct stat stbuff;
|
||||
int exist;
|
||||
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
exist=stat(unname, &stbuff) ? 0 : 1;
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
|
||||
if (!(mode&0x8)) { /* we must test for access */
|
||||
if (exist) { /* test for write rights */
|
||||
@@ -1694,17 +1695,17 @@ int nw_creat_node(int volume, uint8 *unname, int mode)
|
||||
|
||||
if (mode & 2 || (exist && (mode&0x8)) ) { /* trunc */
|
||||
if (0 > (fd=open(unname, O_CREAT|O_TRUNC|O_RDWR, 0666))) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
if (-1 < (fd=open(unname, O_CREAT|O_TRUNC|O_RDWR, 0600)))
|
||||
chown(unname, act_uid, act_gid);
|
||||
reseteuid();
|
||||
if (chown(unname, act_uid, act_gid)) {}
|
||||
(void)reseteuid();
|
||||
}
|
||||
} else if (!exist) {
|
||||
if (0 > (fd = creat(unname, 0777))) {
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
if (-1 < (fd = creat(unname, 0751)))
|
||||
chown(unname, act_uid, act_gid);
|
||||
reseteuid();
|
||||
if (chown(unname, act_uid, act_gid)) {}
|
||||
(void)reseteuid();
|
||||
}
|
||||
}
|
||||
if ( fd > -1 ) {
|
||||
@@ -1726,12 +1727,12 @@ int nw_utime_node(int volume, uint8 *unname, struct stat *stb,
|
||||
ut.actime = ut.modtime = t;
|
||||
if (!utime(unname, &ut))
|
||||
return(0);
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
if (!utime(unname, &ut)) {
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
return(0);
|
||||
}
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
return(-0x8c); /* no modify privileges */
|
||||
}
|
||||
@@ -1806,9 +1807,9 @@ int mv_dir(int dir_handle, uint8 *sourcedata, int sourcedatalen,
|
||||
char unziel[256];
|
||||
xstrcpy(unziel, build_unix_name(&zielpath, 0));
|
||||
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
result = unx_mvdir((uint8 *)qfn, (uint8 *)unziel);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
|
||||
XDPRINTF((4,0, "rendir result=%d, '%s'->'%s'",
|
||||
result, qfn, unziel));
|
||||
@@ -2646,9 +2647,9 @@ static int get_match(uint8 *unixname, uint8 *p)
|
||||
}
|
||||
#endif
|
||||
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
d=opendir(unixname);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
|
||||
if (NULL != d) {
|
||||
struct dirent *dirbuff;
|
||||
@@ -2818,9 +2819,9 @@ int nw_log_file(int lock_flag,
|
||||
if (completition > -1) {
|
||||
char unixname[300];
|
||||
xstrcpy(unixname, build_unix_name(&nwpath, 0));
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
completition = stat(unixname, &stbuff);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
if (!completition) {
|
||||
if (lock_flag < 0) { /* remove lock */
|
||||
if (lock_flag != -1)
|
||||
|
||||
@@ -84,29 +84,29 @@ static void write_to_nwserv(int what, int connection, int mode,
|
||||
{
|
||||
switch (what) {
|
||||
case 0x2222 : /* insert wdog connection */
|
||||
(void)write(FD_NWSERV, &what, sizeof(int));
|
||||
(void)write(FD_NWSERV, &connection, sizeof(int));
|
||||
(void)write(FD_NWSERV, &size, sizeof(int));
|
||||
(void)write(FD_NWSERV, data, size); /* ipxAddr_t + socknr */
|
||||
if (write(FD_NWSERV, &what, sizeof(int)) < 0) {}
|
||||
if (write(FD_NWSERV, &connection, sizeof(int)) < 0) {}
|
||||
if (write(FD_NWSERV, &size, sizeof(int)) < 0) {}
|
||||
if (write(FD_NWSERV, data, size) < 0) {} /* ipxAddr_t + socknr */
|
||||
break;
|
||||
|
||||
case 0x4444 : /* tell the wdog there's no need to look 0 */
|
||||
/* activate wdogs to free connection 1 */
|
||||
/* the connection ist closed 99 */
|
||||
(void)write(FD_NWSERV, &what, sizeof(int));
|
||||
(void)write(FD_NWSERV, &connection, sizeof(int));
|
||||
(void)write(FD_NWSERV, &mode, sizeof(int));
|
||||
if (write(FD_NWSERV, &what, sizeof(int)) < 0) {}
|
||||
if (write(FD_NWSERV, &connection, sizeof(int)) < 0) {}
|
||||
if (write(FD_NWSERV, &mode, sizeof(int)) < 0) {}
|
||||
break;
|
||||
|
||||
case 0x5555 : /* close connection */
|
||||
case 0x6666 : /* send to client that server holds message */
|
||||
(void)write(FD_NWSERV, &what, sizeof(int));
|
||||
(void)write(FD_NWSERV, &connection, sizeof(int));
|
||||
if (write(FD_NWSERV, &what, sizeof(int)) < 0) {}
|
||||
if (write(FD_NWSERV, &connection, sizeof(int)) < 0) {}
|
||||
break;
|
||||
|
||||
case 0xffff : /* tell nwserv to down the server */
|
||||
(void)write(FD_NWSERV, &what, sizeof(int));
|
||||
(void)write(FD_NWSERV, &what, sizeof(int));
|
||||
if (write(FD_NWSERV, &what, sizeof(int)) < 0) {}
|
||||
if (write(FD_NWSERV, &what, sizeof(int)) < 0) {}
|
||||
break;
|
||||
|
||||
default : break;
|
||||
@@ -576,7 +576,7 @@ static void handle_ncp_request(void)
|
||||
in_len;
|
||||
send_to_nwconn(c->fd, (char*)ncprequest, in_len);
|
||||
#else
|
||||
write(c->fd, (char*)ncprequest, in_len);
|
||||
if (write(c->fd, (char*)ncprequest, in_len) < 0) {}
|
||||
#endif
|
||||
XDPRINTF((10,0, "write to %d, anz = %d", c->fd, anz));
|
||||
}
|
||||
@@ -654,7 +654,7 @@ static void handle_ncp_request(void)
|
||||
XDPRINTF((6,0, "GOT 0x3333 in NCPSERV connection=%d", connection));
|
||||
if ( connection > 0 && connection <= count_connections) {
|
||||
CONNECTION *c = &(connections[connection-1]);
|
||||
if (c->fd > -1) write(c->fd, (char*)ncprequest, in_len);
|
||||
if (c->fd > -1 && write(c->fd, (char*)ncprequest, in_len) < 0) {}
|
||||
}
|
||||
#endif
|
||||
} else if (type == 0x1111) {
|
||||
|
||||
@@ -44,13 +44,13 @@ static void put_attr_to_disk(int dev, ino_t inode, uint32 attrib)
|
||||
(int) buf_uc[0],
|
||||
(int) buf_uc[1],
|
||||
(int) buf_uc[2]);
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
unx_xmkdir(buf, 0755);
|
||||
sprintf(buf+l, "/%x", (int) buf_uc[3]);
|
||||
unlink(buf);
|
||||
l=sprintf(battrib, "%08x", (unsigned int) attrib);
|
||||
symlink(battrib, buf);
|
||||
reseteuid();
|
||||
if (symlink(battrib, buf)) {}
|
||||
(void)reseteuid();
|
||||
}
|
||||
|
||||
static void free_attr_from_disk(int dev, ino_t inode)
|
||||
@@ -64,9 +64,9 @@ static void free_attr_from_disk(int dev, ino_t inode)
|
||||
(int) buf_uc[1],
|
||||
(int) buf_uc[2],
|
||||
(int) buf_uc[3]);
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
unlink(buf);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
}
|
||||
|
||||
static int get_attr_from_disk(int dev, ino_t inode, uint32 *attrib)
|
||||
@@ -83,9 +83,9 @@ static int get_attr_from_disk(int dev, ino_t inode, uint32 *attrib)
|
||||
(int) buf_uc[1],
|
||||
(int) buf_uc[2],
|
||||
(int) buf_uc[3]);
|
||||
seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
l=readlink(buf, battrib, 224);
|
||||
reseteuid();
|
||||
(void)reseteuid();
|
||||
if (l > 0) {
|
||||
unsigned int uattrib=0;
|
||||
battrib[l]='\0';
|
||||
|
||||
24
src/nwfile.c
24
src/nwfile.c
@@ -152,7 +152,7 @@ static int free_file_handle(int fhandle)
|
||||
/* now set date and time */
|
||||
struct utimbuf ut;
|
||||
ut.actime = ut.modtime = fh->tmodi;
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
utime(fh->fname, &ut);
|
||||
(void)reseteuid();
|
||||
fh->tmodi = 0L;
|
||||
@@ -209,7 +209,7 @@ static int open_with_root_access(char *path, int mode)
|
||||
{
|
||||
int fd = open(path, mode);
|
||||
if (fd < 0 && errno == EACCES) {
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
fd = open(path, mode);
|
||||
(void)reseteuid();
|
||||
}
|
||||
@@ -299,7 +299,7 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
||||
|
||||
if (!exist) {
|
||||
/* we do it again as root to get always the correct information */
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
exist = stat(unixname, stbuff) ? 0 : 1;
|
||||
(void)reseteuid();
|
||||
}
|
||||
@@ -407,7 +407,7 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
||||
uint8 *p=(uint8*)strrchr(unixname, '/');
|
||||
if (NULL != p && ((p - unixname)+1) >= volnamlen ) { /* parent dir */
|
||||
*p='\0';
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
completition=stat(unixname, stbuff);
|
||||
(void)reseteuid();
|
||||
if (!completition) {
|
||||
@@ -474,7 +474,7 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
||||
fh->fd = open_with_root_access(fh->fname, acm);
|
||||
if (fh->fd != -1){
|
||||
if (acm&O_TRUNC) {
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
stat(fh->fname, stbuff);
|
||||
(void)reseteuid();
|
||||
}
|
||||
@@ -492,7 +492,7 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
||||
if (fh->fd==-1)
|
||||
completition=-0x9c;
|
||||
else {
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
stat(fh->fname, stbuff);
|
||||
(void)reseteuid();
|
||||
}
|
||||
@@ -672,7 +672,7 @@ int nw_close_file(int fhandle, int reset_reuse, int task)
|
||||
&& !(fh->fh_flags & FH_IS_READONLY)) {
|
||||
struct utimbuf ut;
|
||||
ut.actime = ut.modtime = fh->tmodi;
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
utime(fh->fname, &ut);
|
||||
(void)reseteuid();
|
||||
fh->tmodi = 0L;
|
||||
@@ -715,7 +715,7 @@ int nw_commit_file(int fhandle)
|
||||
if (fh->tmodi > 0L) {
|
||||
struct utimbuf ut;
|
||||
ut.actime = ut.modtime = fh->tmodi;
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
utime(fh->fname, &ut);
|
||||
(void)reseteuid();
|
||||
fh->tmodi = 0L;
|
||||
@@ -729,7 +729,7 @@ int nw_commit_file(int fhandle)
|
||||
if (fh->tmodi > 0L) {
|
||||
struct utimbuf ut;
|
||||
ut.actime = ut.modtime = fh->tmodi;
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
utime(fh->fname, &ut);
|
||||
(void)reseteuid();
|
||||
}
|
||||
@@ -1268,7 +1268,7 @@ int nw_log_logical_record(int lock_flag,
|
||||
new_str(path_share_lock_files, buff);
|
||||
else
|
||||
new_str(path_share_lock_files, "/var/spool/nwserv/.locks");
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
unx_xmkdir(path_share_lock_files, 0755);
|
||||
(void)reseteuid();
|
||||
}
|
||||
@@ -1282,7 +1282,7 @@ int nw_log_logical_record(int lock_flag,
|
||||
if (lock_flag < 0) /* unlock */
|
||||
return(-0xff);
|
||||
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
fd = open(fullpath, O_RDWR|O_CREAT, 0600);
|
||||
(void)reseteuid();
|
||||
|
||||
@@ -1340,7 +1340,7 @@ int nw_log_logical_record(int lock_flag,
|
||||
close(lf->fd);
|
||||
|
||||
#if 0 /* TODO remove file if it is not opened/locked by other process */
|
||||
(void)seteuid(0);
|
||||
if (seteuid(0)) {}
|
||||
unlink(fullpath);
|
||||
(void)reseteuid();
|
||||
#endif
|
||||
|
||||
@@ -401,7 +401,7 @@ static int del_trustee_from_disk(int volume, dev_t dev, ino_t inode, uint32 id)
|
||||
if (seteuid(0)) {}
|
||||
if (!unlink(buf))
|
||||
result=0;
|
||||
if (reseteuid()) {}
|
||||
(void)reseteuid();
|
||||
return(result);
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ unsigned int tru_vol_sernum(int volume, int mode)
|
||||
slprintf(buf1, sizeof(buf1)-1, "%x", sernum);
|
||||
if (symlink(buf1, buf))
|
||||
errorp(0, "rw_trustee_sernum", "symlink %s %s failed", buf1, buf);
|
||||
if (reseteuid()) {}
|
||||
(void)reseteuid();
|
||||
tru_free_cache(volume);
|
||||
}
|
||||
return(sernum);
|
||||
@@ -454,7 +454,7 @@ void tru_free_file_trustees_from_disk(int volume, int dev, ino_t inode)
|
||||
/* now we remove the name of the dir/file */
|
||||
slprintf(buf+len, sizeof(buf) -len -1, "n.%x", (int)buf_uc[3]);
|
||||
unlink(buf);
|
||||
if (reseteuid()) {}
|
||||
(void)reseteuid();
|
||||
}
|
||||
|
||||
int tru_del_trustee(int volume, uint8 *unixname, struct stat *stb, uint32 id)
|
||||
@@ -614,7 +614,7 @@ static int local_tru_add_trustee_set(int volume, uint8 *unixname,
|
||||
nwoic->id, nwoic->trustee, volume, unixname, -result);
|
||||
})
|
||||
if (result){
|
||||
if (reseteuid()) {}
|
||||
(void)reseteuid();
|
||||
goto func_err;
|
||||
}
|
||||
nwoic++;
|
||||
@@ -626,7 +626,7 @@ static int local_tru_add_trustee_set(int volume, uint8 *unixname,
|
||||
*(ufn+1)='\0';
|
||||
}
|
||||
creat_trustee_path(volume, stb->st_dev, stb->st_ino, ufn);
|
||||
if (reseteuid()) {}
|
||||
(void)reseteuid();
|
||||
#if 0 /* now in tru_add_trustee_set */
|
||||
tru_vol_sernum(volume, 1); /* trustee sernum needs updated */
|
||||
#endif
|
||||
@@ -675,7 +675,7 @@ int tru_add_trustee_set(int volume, uint8 *unixname,
|
||||
*p='/';
|
||||
}
|
||||
}
|
||||
if (reseteuid()) {}
|
||||
(void)reseteuid();
|
||||
tru_vol_sernum(volume, 1); /* trustee sernum needs updated */
|
||||
}
|
||||
return (result);
|
||||
@@ -717,7 +717,7 @@ int tru_set_inherited_mask(int volume, uint8 *unixname,
|
||||
int result;
|
||||
if (seteuid(0)) {}
|
||||
result=put_trustee_to_disk(volume, stb->st_dev, stb->st_ino, 0L, new_mask);
|
||||
if (reseteuid()) {}
|
||||
(void)reseteuid();
|
||||
if (!result)
|
||||
tru_vol_sernum(volume, 1); /* trustee sernum needs updated */
|
||||
return(result);
|
||||
|
||||
Reference in New Issue
Block a user