]> oss.titaniummirror.com Git - repo_shell.git/blobdiff - repo_shell.c
Correctly exit on interactive shell request when not allowed
[repo_shell.git] / repo_shell.c
index 9d775593d7b3f039a0a62ddad71be41e0bd2f939..4d9f79b8325fa0626efbaccafe0214fdb9379ff0 100644 (file)
@@ -186,16 +186,18 @@ int main(int argc, char **argv)
     die("opening /dev/null failed");
   close (devnull_fd);
 
-  if (argc == 2 && (!strcmp(argv[1], "-v") ||
-      !strcmp(argv[1], "--version"))) {
+  if (argc == 2 && (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version"))) {
     fprintf(stderr, "%s\n", version);
     return 0;
   }
 
-  if (argc == 1 && check_ssh_interactive(getuid())) {
+  if (argc == 1) {
+    if (!check_ssh_interactive(getuid()))
+      die("only repository access is allowed");
     setuid(getuid());
     argv[0] = SHELL;
     execvp(argv[0], (char *const *) argv);
+    return 1;
   }
 
   if (ini_parse(CFG_FILE, ini_handler, &cfg) < 0)