Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* TCB passwd database code wanted
@ 1994-12-18 21:39 Dave Rasmussen
  1994-12-19 20:58 ` Clyde Hoover
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Rasmussen @ 1994-12-18 21:39 UTC (permalink / raw)



I am looking to see if anyone has any source code for updating the
shadow password file database on osf1 version3. Since my last post
I've only gotten "send me whatever you find out" messages.

Thanks in advance. 
-- 
Dave Rasmussen - Information & Media Technologies (ex-CSD) Systems Group
Internet: dave@csd.uwm.edu  Phone: 414-229-5133  2m HAM Radio: N9REJ 
USmail: Box 413 EMS380, Milwaukee, WI 53201



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: TCB passwd database code wanted
  1994-12-18 21:39 TCB passwd database code wanted Dave Rasmussen
@ 1994-12-19 20:58 ` Clyde Hoover
  0 siblings, 0 replies; 2+ messages in thread
From: Clyde Hoover @ 1994-12-19 20:58 UTC (permalink / raw)


dave@csd4.csd.uwm.edu (Dave Rasmussen) wrote:
>
> 
> I am looking to see if anyone has any source code for updating the
> shadow password file database on osf1 version3. Since my last post
> I've only gotten "send me whatever you find out" messages.

Here's code taken from version 2.0 of the 'npasswd' program that
I'm working on.  This module does in fact work and updates the auth
database just fine. 

HOVEVER, some assembly will be required to make this go.

------ Cut here --------
/*
 *      Support for OSF1 auth database
 */
#include <sys/secdefines.h>
#include <sys/security.h>
#include <sia.h>
#include <prot.h>

/* code that needs to be somewhere upstream ... */
        /*
         * If there is a Trusted Computing Base directory, then
         * we are running enhanced security.  On OSF/1, the data returned
         * by getsvc() will NOT be right.
         */
        if (access("/tcb", 0) == 0) {
                SIAENTITY *who;
                sia_ses_init(&who, argc, argv, NULL, NULL, NULL, 0, NULL);
        }
/* ... */ * Routine to update OSF/1 auth database
 */
update_auth(theUser, newUser)
        struct passwd   *theUser;
        struct passwd   *newUser;
{
        struct pr_passwd *pw,           /* Auth password db lookup temp */
                         px;            /* Auth password update temp */
        int     pwdepth = 0;            /* Depth of password dictionary */

        if ((pw = getprpwnam(newUser->pw_name)) == NULL) {
                logdie("Cannot get shadow password for %s\n",
                        newUser->pw_name);
        }
        px = *pw;
        /*
         * Add current encrypted password to users' dictionary
         * to be compatible with DEC's passwd program.
         */
        if (px.sflg.fg_pwdepth) pwdepth = px.sfld.fd_pwdepth;
        if (px.uflg.fg_pwdepth) pwdepth = px.ufld.fd_pwdepth;
        if (pwdepth) {
                char    newhist[AUTH_MAX_PASSWD_DICT_SIZE];
                int     hl;
                (void) strcpy(newhist, px.ufld.fd_encrypt);
                hl = strlen(newhist);
                if (px.ufld.fd_pwdict[0]) {
                        char    *ts, *te;
                        int     ni = 2;

                        ts = te = px.ufld.fd_pwdict;
                        while (*ts) {
                                while (*te && *te != ',') *te++; 
                                if (*te)
                                        *te++ = '\0';
                                if (ni > pwdepth ||
                                    hl + strlen(ts) + 2 >= AUTH_MAX_PASSWD_DICT_SIZE)
                                        break;
                                (void) strcat(newhist, ",");
                                (void) strcat(newhist, ts);
                                hl = strlen(newhist);
                                ni++;
                                ts = te;
                        }
                        (void) strcpy(px.ufld.fd_pwdict, newhist);
                        px.uflg.fg_pwdict = 1;
                }        /*
         * Plug new values into auth structure
         */
        (void) strcpy(px.ufld.fd_encrypt, newUser->pw_passwd);
        px.ufld.fd_schange = time((time_t *)0);
        px.ufld.fd_pwchanger = getuid();
        px.ufld.fd_oldcrypt = 0;
        /*
         * Set flags to indicate which values were changed
         */
        px.uflg.fg_schange = 
        px.uflg.fg_oldcrypt = 
        px.uflg.fg_pwchanger = 
        px.uflg.fg_encrypt = 1;
        /*
         * Update the auth database
         */
        if (putprpwnam(newUser->pw_name, &px) == 0)
                logdie("Could not update auth database.");
        /*
         * Insert plug value for password (in case it gets written)
         */
        newUser->pw_passwd = "*";
        printf("update_shadow: updated auth for %s\n", newUser->pw_name);
}
/*
 * Dump OSF/1 auth database fields & flags structures
 */
dump_field(f, p)
        struct pr_flag *f;
        struct pr_field *p;
{
        if (f->fg_name) printf("fd_name = %s\n", p->fd_name);
        if (f->fg_uid) printf("fd_uid = %d\n", p->fd_uid);
        if (f->fg_encrypt) printf("fd_encrypt = %s\n", p->fd_encrypt);
        if (f->fg_owner) printf("fd_owner = %s\n", p->fd_owner);
        if (f->fg_nice) printf("fd_nice = %d\n", p->fd_nice);
        if (f->fg_cprivs) printf("fd_cprivs = %x\n", p->fd_cprivs);
        if (f->fg_sprivs) printf("fd_sprivs = %x\n", p->fd_sprivs);
        if (f->fg_bprivs) printf("fd_bprivs = %x\n", p->fd_bprivs);
        if (f->fg_auditdisp) printf("fd_auditdisp = %x\n", p->fd_auditdisp);
        if (f->fg_auditcntl) printf("fd_auditcntl = %x\n", p->fd_auditcntl);
        if (f->fg_min) printf("fd_min = %d\n", p->fd_min);
        if (f->fg_minlen) printf("fd_minlen = %d\n", p->fd_minlen);
        if (f->fg_maxlen) printf("fd_maxlen = %d\n", p->fd_maxlen);
        if (f->fg_expire) printf("fd_expire = %d\n", p->fd_expire);
        if (f->fg_lifetime) printf("fd_lifetime = %d\n", p->fd_lifetime);
        if (f->fg_schange) printf("fd_schange = %s", ctime(&p->fd_schange));
        if (f->fg_uchange) printf("fd_uchange = %d\n", p->fd_uchange);
        if (f->fg_pick_pwd) printf("fd_pick_pwd = %d\n", p->fd_pick_pwd);
        if (f->fg_gen_pwd) printf("fd_gen_pwd = %d\n", p->fd_gen_pwd);
        if (f->fg_restrict) printf("fd_restrict = %d\n", p->fd_restrict);
        if (f->fg_policy) printf("fd_policy = %d\n", p->fd_policy);
        if (f->fg_nullpw) printf("fd_nullpw = %d\n", p->fd_nullpw);
        if (f->fg_pwchanger) printf("fd_pwchanger = %d\n", p->fd_pwchanger);
        if (f->fg_gen_chars) printf("fd_gen_chars = %d\n", p->fd_gen_chars);
        if (f->fg_gen_letters) printf("fd_gen_letters = %d\n", p->fd_gen_letters);
        if (f->fg_pwdepth) printf("fd_pwdepth = %d\n", p->fd_pwdepth);
        if (f->fg_pwdict) printf("fd_pwdict = %s\n", p->fd_pwdict);
        if (f->fg_oldcrypt) printf("fd_oldcrypt = %d\n", p->fd_oldcrypt);
        if (f->fg_newcrypt) printf("fd_newcrypt = %d\n", p->fd_newcrypt);
        if (f->fg_slogin) printf("fd_slogin = %s", ctime(&p->fd_slogin));
        if (f->fg_ulogin) printf("fd_ulogin = %s", ctime(&p->fd_ulogin));
        if (f->fg_suctty) printf("fd_suctty = %s\n", p->fd_suctty);
        if (f->fg_unsuctty) printf("fd_unsuctty = %s\n", p->fd_unsuctty);
        if (f->fg_nlogins) printf("fd_nlogins = %u\n", p->fd_nlogins);
        if (f->fg_tod) printf("fd_tod = %s\n", p->fd_tod);
        if (f->fg_max_tries) printf("fd_max_tries = %u\n", p->fd_max_tries);
        if (f->fg_unlockint) printf("fd_unlockint = %u\n", p->fd_unlockint);
        if (f->fg_retired) printf("fd_retired = %u\n", p->fd_retired);
        if (f->fg_lock) printf("fd_lock = %u\n", p->fd_lock);
        if (f->fg_expdate) printf("fd_expdate = %s", ctime(&p->fd_expdate));
        if (f->fg_istemplate) printf("fd_istemplate = %u\n", p->fd_istemplate);
        if (f->fg_template) printf("fd_template = %s\n", p->fd_template);
}
---------- Cut here 

Clyde Hoover                   | "When vitural reality becomes
(Shouter-To-Dead-Parrots)      |  cheaper than dating,
UNIX Sys Admin Tiger Team      |  society is doomed."
Computation Center, UT Austin  |        -Dogbert
clyde@motown.cc.utexas.edu     | 
"We are SMART! ... We make things GO!"           




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-12-19 20:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-12-18 21:39 TCB passwd database code wanted Dave Rasmussen
1994-12-19 20:58 ` Clyde Hoover

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