Fix malformed patch on cgcs-users/ibsh

The cgcs-users patches started to fail after the tarball download
was enabled. This was because the indentation is different in the
downloaded source code.

In the past, ibsh was get from an internal repository and presumably
this source code was modified before get checked in into the repo.

Change-Id: I0b36bedc35a6002bd596c0d2bd6729ccb37285ae
Signed-off-by: Erich Cordoba <erich.cordoba.malibran@intel.com>
This commit is contained in:
Erich Cordoba 2018-07-09 16:01:50 -07:00
parent 67202ded0a
commit e243ee6e61
1 changed files with 48 additions and 51 deletions

View File

@ -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++;
}
}