Lines 163-168
bool opt_filter(char **vec, const char opt)
Link Here
|
163 |
|
163 |
|
164 |
bool check_command( char *cl, ShellOptions_t *opts, char *cmd, int cmdflag ) |
164 |
bool check_command( char *cl, ShellOptions_t *opts, char *cmd, int cmdflag ) |
165 |
{ |
165 |
{ |
|
|
166 |
char *cmd_dup; |
166 |
char *prog; /* basename of cmd */ |
167 |
char *prog; /* basename of cmd */ |
167 |
char *tmp = cl; |
168 |
char *tmp = cl; |
168 |
bool need_free = FALSE; |
169 |
bool need_free = FALSE; |
Lines 186-196
bool check_command( char *cl, ShellOptions_t *opts, char *cmd, int cmdflag )
Link Here
|
186 |
} |
187 |
} |
187 |
|
188 |
|
188 |
/* compare tmp to cmd and prog for match */ |
189 |
/* compare tmp to cmd and prog for match */ |
189 |
prog = basename(cmd); |
190 |
cmd_dup = strdup(cmd); |
|
|
191 |
prog = basename(cmd_dup); |
190 |
if ( !(strcmp(tmp, cmd)) || !(strcmp(tmp, prog))){ |
192 |
if ( !(strcmp(tmp, cmd)) || !(strcmp(tmp, prog))){ |
191 |
log_msg("cmd '%s' approved", prog); |
193 |
log_msg("cmd '%s' approved", prog); |
192 |
rc = TRUE; |
194 |
rc = TRUE; |
193 |
} |
195 |
} |
|
|
196 |
free(cmd_dup); |
194 |
} |
197 |
} |
195 |
if (need_free) free(tmp); |
198 |
if (need_free) free(tmp); |
196 |
return rc; |
199 |
return rc; |