From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96079034715751.tru64-unix-managers.marc@archive.invalid> From: Ellen Davis Date: Thu, 21 Jan 1999 19:12:06 +0000 To: tru64-unix-managers Subject: chsh program X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96079034715751 Hello managers, I have a need to be able to change a user's shell via the web. I am running DU4.0D with enhanced security. I have written a small C program (based on a program from another posting). I have never used the sia routines before. This program seems to work ok. Does anyone see any problesm which may arise beside the normal checks (account exists, do not change root accounts). #include #include int my_collect(int timeout, int rendition, unsigned char* title, int num_prompts, prompt_t *prompts) { unsigned char ftpshell[] = "/usr/local/ftpshell"; /* IF the user's shell is /usr/local/profile, then change it to /usr/local/ftpshell * Else return error */ if (strncmp(prompts[0].prompt, "Old shell: /usr/local/profile\nNew shell: ",39) == 0) { printf("Changing shell ...\n"); strncpy(prompts[0].result,ftpshell); return SIACOLSUCCESS; } else return SIACOLABORT; } int main(int argc, char** argv) { /* If no user name is specified, then the sia routines change the * current user's info. */ char* user = 0; char* progname; int i,res; /* strip off leading path to work out who we are */ /*progname = strrchr(argv[0], '/'); */ progname = argv[0] = "chsh"; user = argv[1]; /*sia_chk_invoker(); */ res = sia_chg_shell(my_collect, user, argc, argv); if (res == SIASUCCESS) printf("Shell was changed.\n"); else printf("Shell was not changed.\n"); return res; } Ellen Davis Ellen.Davis@uc.edu