static int PushDirState(char *name, struct stat *sb) { if (chdir(name) == -1) { CfOut(cf_inform, "chdir", "Could not change to directory %s, mode %o in tidy", name, sb->st_mode & 07777); return false; } else { CfDebug("Changed directory to %s\n", name); } CheckLinkSecurity(sb, name); return true; }
int DirPush(char *name,struct stat *sb) /* Enter dir and check for race exploits */ { if (chdir(name) == -1) { snprintf(OUTPUT,CF_BUFSIZE,"Could not change to directory %s, mode %o in tidy",name,sb->st_mode & 07777); CfLog(cfinform,OUTPUT,"chdir"); return false; } else { Debug("Changed directory to %s\n",name); } CheckLinkSecurity(sb,name); return true; }
static void PopDirState(int goback, char *name, struct stat *sb, Recursion r) { if (goback && r.travlinks) { if (chdir(name) == -1) { CfOut(cf_error, "chdir", "Error in backing out of recursive travlink descent securely to %s", name); HandleSignals(SIGTERM); } CheckLinkSecurity(sb, name); } else if (goback) { if (chdir("..") == -1) { CfOut(cf_error, "chdir", "Error in backing out of recursive descent securely to %s", name); HandleSignals(SIGTERM); } } }
void DirPop(int goback,char * name,struct stat *sb) /* Exit dir and check for race exploits */ { if (goback && TRAVLINKS) { if (chdir(name) == -1) { snprintf(OUTPUT,CF_BUFSIZE,"Error in backing out of recursive descent securely to %s",name); CfLog(cferror,OUTPUT,"chdir"); HandleSignal(SIGTERM); } CheckLinkSecurity(sb,name); } else if (goback) { if (chdir("..") == -1) { snprintf(OUTPUT,CF_BUFSIZE,"Error in backing out of recursive descent securely to %s",name); CfLog(cferror,OUTPUT,"chdir"); HandleSignal(SIGTERM); } } }