tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* chsh program
@ 1999-01-21 19:12 Ellen Davis
  0 siblings, 0 replies; only message in thread
From: Ellen Davis @ 1999-01-21 19:12 UTC (permalink / raw)
  To: tru64-unix-managers


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 <sia.h>
#include <siad.h>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-01-21 19:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-01-21 19:12 chsh program Ellen Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox