Clean up ftrustee, namspace and unxlog warning paths

This commit is contained in:
Mario Fetka
2026-04-20 23:39:42 +02:00
parent e8d7eb88b6
commit 176a54367b
3 changed files with 17 additions and 17 deletions

View File

@@ -33,7 +33,7 @@ static gid_t *act_grouplist=NULL; /* first element is counter !! */
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 !!",
@@ -60,7 +60,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;
@@ -124,8 +124,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)) {
@@ -139,8 +139,8 @@ 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);
}

View File

@@ -257,7 +257,7 @@ static int nwp_stat(N_NW_PATH *nwpath, char *debstr)
int result=stat(uname, &(nwpath->statb));
if (result && errno == EACCES){ /* mst:14-Apr-00 */
seteuid(0);
if (seteuid(0)) {}
result = stat(uname, &(nwpath->statb));
reseteuid();
}
@@ -319,11 +319,11 @@ static void put_dbe_to_disk(DIR_BASE_ENTRY *dbe)
(int) inode_uc[1],
(int) inode_uc[2]);
seteuid(0);
if (seteuid(0)) {}
unx_xmkdir(buf, 0755);
sprintf(buf+l, "/%x", (int) inode_uc[3]);
unlink(buf);
symlink(dbe->nwpath.path, buf);
if (symlink((char*)dbe->nwpath.path, buf)) {}
reseteuid();
}
@@ -349,7 +349,7 @@ static void del_dbe_from_disk(DIR_BASE_ENTRY *dbe)
(int) inode_uc[1],
(int) inode_uc[2],
(int) inode_uc[3]);
seteuid(0);
if (seteuid(0)) {}
unlink(buf);
reseteuid();
}
@@ -383,7 +383,7 @@ static int get_dbe_data_from_disk(int volume,
(int) inode_uc[2],
(int) inode_uc[3]);
seteuid(0);
if (seteuid(0)) {}
l=readlink(buf, path, 511);
reseteuid();
@@ -1536,7 +1536,7 @@ static int search_match(struct dirent *dirbuff,
statflag = stat(ds->unixname, &statb);
if (statflag && errno == EACCES) { /* mst:21-Apr-00 */
seteuid(0);
if (seteuid(0)) {}
statflag = stat(ds->unixname, &statb);
reseteuid();
}
@@ -1641,7 +1641,7 @@ int nw_search_file_dir(int namespace, int datastream,
DIR_SEARCH_STRUCT *ds=(DIR_SEARCH_STRUCT*) xcmalloc(sizeof(DIR_SEARCH_STRUCT));
ds->unixname = unixname;
if (NULL == (ds->fdir = opendir(ds->unixname)) ) {
seteuid(0);
if (seteuid(0)) {}
ds->fdir=opendir(ds->unixname);
reseteuid();
}
@@ -1940,7 +1940,7 @@ static int func_search_entry(DIR_BASE_ENTRY *dbe, int namespace,
if (!tru_eff_rights_exists(dbe->nwpath.volume, ds->unixname,
&(dbe->nwpath.statb), TRUSTEE_F)) {
if (NULL == (ds->fdir = opendir(ds->unixname)) ) {
seteuid(0);
if (seteuid(0)) {}
ds->fdir = opendir(ds->unixname);
reseteuid();
}
@@ -2342,7 +2342,7 @@ static int nw_rename_file_dir(int namespace,
result=-0x8b;
if (result > -1) {
seteuid(0);
if (seteuid(0)) {}
if (S_ISDIR(dbe_s->nwpath.statb.st_mode))
result = unx_mvdir(unname_s, unname_d);
else
@@ -2448,7 +2448,7 @@ static int nw_modify_file_dir(int namespace,
ut.modtime = nw_2_un_time(datetime+2, datetime);
if (-1==utime(uname, &ut)) {
seteuid(0);
if (seteuid(0)) {}
utime(uname, &ut);
reseteuid();
}

View File

@@ -76,7 +76,7 @@ void write_utmp(int dologin, int connection, int pid,
endutent();
if (NULL == fn_wtmp) return;
if ((fd = open(fn_wtmp, O_APPEND|O_WRONLY)) > -1) {
write(fd, (char *)ut, sizeof(struct utmp));
if (write(fd, (char *)ut, sizeof(struct utmp)) < 0) {}
close(fd);
}
#endif /* !FREEBSD */