Path: news.mitre.org!blanket.mitre.org!philabs!newsjunkie.ans.net!newsfeeds.ans.net!news-was.dfn.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cam-news-hub1.bbnplanet.com!cpk-news-feed3.bbnplanet.com!news.bbnplanet.com!topgun.es.dupont.com!usenet
From: "Paul K.E. Walker" <PAUL-K.E.WALKER@COASTALNET.COM>
Newsgroups: comp.os.vms
Subject: Re: Enabling User Account with $SETUAI...
Date: Wed, 7 Jan 1998 16:08:19 -0500
Organization: DuPont Experimental Station
Lines: 62
Message-ID: <690qsb$h8b@topgun.es.dupont.com>
References: <34b3bbb9.0@dante.axent.com>
NNTP-Posting-Host: walkerp1.kn.dupont.com
Mime-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3


Ken Adey wrote in message <34b3bbb9.0@dante.axent.com>...
>Has anyone used the $SETUAI system service to enable a disabled
>user account? Is it possible, and if so, how'd you do it?
>
>Thanks.
>
>Ken....


        PROGRAM ACCOUNT_ENABLE
        IMPLICIT NONE

        INCLUDE 'SYS$LIBRARY:FORSYSDEF($SSDEF)/NOLIST '
        INCLUDE 'SYS$LIBRARY:FORSYSDEF($UAIDEF)/NOLIST '
        INTEGER*4   nullarg /0/             !Digital Placeholder
        INTEGER*4   contxt  /-1/            !UAF context (for successive
                                            !SETUAI calls)
        INTEGER*4   lgi_flags               !UAF flags longword
        INTEGER*4   ignore                  !Ignored field
        INTEGER*4   status                  !Return status

        CHARACTER*8 usrnam  /'JOHN_DOE'/    !UAF username
        STRUCTURE /item_list_3/
            INTEGER*2        buflen         !Length of buffer
            INTEGER*2        itmcod         !Item code
            INTEGER*4        bufadr         !Buffer address
            INTEGER*4        retlen         !Return length address
        END STRUCTURE
        RECORD /item_list_3/ itmlst(2)
        INTEGER*4   SYS$GETUAI              !Get UAF information
        INTEGER*4   SYS$SETUAI              !Set UAF information
        itmlst(1).buflen = 4                !One longword mask of data
        itmlst(1).itmcod = UAI$_FLAGS       !Get/set login flags for user
        itmlst(1).bufadr = %LOC(lgi_flags)  !Login flag longword
        itmlst(1).retlen = %LOC(ignore)     !Don't care
        itmlst(2).itmcod = 0                !End of list
        status = SYS$GETUAI(                !Get Flags
        1   nullarg,
        1   contxt,
        1   usrnam,
        1   itmlst,
        1   nullarg,
        1   nullarg,
        1   nullarg)
        IF (status.NE.SS$_NORMAL) CALL LIB$STOP(%VAL(status))
        lgi_flags = IBCLR(lgi_flags,UAI$V_DISACNT)  !Clear DISUSER flag
        contxt = -1                                 !Reset context for
SETUAI
        status = SYS$SETUAI(                !Set Flags
        1   nullarg,
        1   contxt,
        1   usrnam,
        1   itmlst,
        1   nullarg,
        1   nullarg,
        1   nullarg)
        IF (status.NE.SS$_NORMAL) CALL LIB$STOP(%VAL(status))
        END

Paul K.E. Walker

