Merge "Fix malformed patch on cgcs-users/ibsh"
This commit is contained in:
commit
ac1aded3ed
|
@ -24,64 +24,61 @@ Index: cgcs-users-1.0-r0/main.c
|
|||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char temp[STRING_SIZE], *buf;
|
||||
struct stat info;
|
||||
uid_t ruid, euid;
|
||||
gid_t rgid, egid;
|
||||
+ unsigned int tout_cli = 0;
|
||||
char temp[STRING_SIZE], *buf;
|
||||
struct stat info;
|
||||
uid_t ruid, euid;
|
||||
gid_t rgid, egid;
|
||||
+ unsigned int tout_cli = 0;
|
||||
|
||||
+ const char* tout = getenv("TMOUT");
|
||||
+ if (tout)
|
||||
+ tout_cli = atoi(tout);
|
||||
+ else
|
||||
+ //default to 5 mins
|
||||
+ tout_cli = 300;
|
||||
+ const char* tout = getenv("TMOUT");
|
||||
+ if (tout)
|
||||
+ tout_cli = atoi(tout);
|
||||
+ else
|
||||
+ //default to 5 mins
|
||||
+ tout_cli = 300;
|
||||
|
||||
/* setuid protection */
|
||||
ruid = getuid();
|
||||
/* setuid protection */
|
||||
ruid = getuid();
|
||||
@@ -107,6 +123,7 @@ int main(int argc, char **argv)
|
||||
signal( SIGQUIT, SIG_IGN );
|
||||
signal( SIGTERM, SIG_IGN );
|
||||
signal( SIGTSTP, SIG_IGN );
|
||||
+ signal( SIGALRM, ALRMhandler );
|
||||
LoadConfig();
|
||||
signal( SIGQUIT, SIG_IGN );
|
||||
signal( SIGTERM, SIG_IGN );
|
||||
signal( SIGTSTP, SIG_IGN );
|
||||
+ signal( SIGALRM, ALRMhandler );
|
||||
LoadConfig();
|
||||
|
||||
/* Command mode */
|
||||
/* Command mode */
|
||||
@@ -144,6 +161,7 @@ int main(int argc, char **argv)
|
||||
/* will be allowed to run, unless it is mentioned in the */
|
||||
/* config files. Files that are created with an extension */
|
||||
/* that is listed in the other config file, must be deleted! */
|
||||
/* will be allowed to run, unless it is mentioned in the */
|
||||
/* config files. Files that are created with an extension */
|
||||
/* that is listed in the other config file, must be deleted! */
|
||||
+ alarm(tout_cli);
|
||||
for ( ; ; ) {
|
||||
/* Where is he ? */
|
||||
getcwd(real_path, STRING_SIZE);
|
||||
@@ -153,12 +171,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
/* We don't want the user to know where he actually is. */
|
||||
/* This is the prompt! */
|
||||
- printf("[%s]%% ", jail_path);
|
||||
+ printf("[%s]%% ", loggedin.uname);
|
||||
/* scanf("%s", user_command); */
|
||||
myscanf(user_command, real_path);
|
||||
+ alarm(tout_cli);
|
||||
for ( ; ; ) {
|
||||
/* Where is he ? */
|
||||
getcwd(real_path, STRING_SIZE);
|
||||
@@ -153,12 +171,14 @@ int main(int argc, char **argv)
|
||||
}
|
||||
/* We don't want the user to know where he actually is. */
|
||||
/* This is the prompt! */
|
||||
- printf("[%s]%% ", jail_path);
|
||||
+ //printf("[%s]%% ", jail_path);
|
||||
+ printf("[%s]%% ", loggedin.uname);
|
||||
/* scanf("%s", user_command); */
|
||||
myscanf(user_command, real_path);
|
||||
+ alarm(tout_cli);
|
||||
/* Command interpretation and execution. */
|
||||
if ( (CommandOK(user_command, loggedin.udir, jail_path, filtered_command)) == 0 ) {
|
||||
- printf("Sorry, can't let you do that!\n");
|
||||
+ //printf("Sorry, can't let you do that!\n");
|
||||
log_attempt(loggedin.uname); /* v0.2a */
|
||||
continue;
|
||||
}
|
||||
/* Command interpretation and execution. */
|
||||
if ( (CommandOK(user_command, loggedin.udir, jail_path, filtered_command)) == 0 ) {
|
||||
- printf("Sorry, can't let you do that!\n");
|
||||
log_attempt(loggedin.uname); /* v0.2a */
|
||||
continue;
|
||||
}
|
||||
Index: cgcs-users-1.0-r0/config.c
|
||||
===================================================================
|
||||
--- cgcs-users-1.0-r0.orig/config.c
|
||||
+++ cgcs-users-1.0-r0/config.c
|
||||
@@ -166,7 +166,7 @@ int LoadConfig( void )
|
||||
// Delete '\n'
|
||||
tmp2[i][strlen(tmp2[i]) - 1] = '\0';
|
||||
strncpy(extensions[i],tmp2[i],strlen(tmp2[i]));
|
||||
- printf("EXTENSIONS %s\n",extensions[i]);
|
||||
+ //printf("EXTENSIONS %s\n",extensions[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,6 @@ int LoadConfig( void )
|
||||
// Delete '\n'
|
||||
tmp2[i][strlen(tmp2[i]) - 1] = '\0';
|
||||
strncpy(extensions[i],tmp2[i],strlen(tmp2[i]));
|
||||
- printf("EXTENSIONS %s\n",extensions[i]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue