  Accessing SYSUAF Username Records via $setuai? 
 The Question is:
 
Do you know of a way of resetting the Login Fails back to zero within authorize
 without actually logging in. I can't find any VMS command/utility/freeware
 that will actually do this...
 
 
 The Answer is :
 
  A sufficiently-privileged user can use a simple program and particularly
  a call to the $setuai system service for this purpose.
 
  In deference to various web browsers, the angle brackets normally used
  in this and other C programs have been here converted over into braces.
 
 
/*
**
** COPYRIGHT (c) 1992, 1998 BY
** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
** ALL RIGHTS RESERVED.
**
** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
** ONLY  IN  ACCORDANCE  OF  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR  ANY  OTHER
** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
** OTHER PERSON.  NO TITLE TO AND  OWNERSHIP OF THE  SOFTWARE IS  HEREBY
** TRANSFERRED.
**
** THE INFORMATION IN THIS SOFTWARE IS  SUBJECT TO CHANGE WITHOUT NOTICE
** AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
** CORPORATION.
**
** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE  OR  RELIABILITY OF ITS
** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
**
*/
 
/*
**
**  Facility:
**
**	Examples
**
**  Version: V1.0
**
**  Abstract:
**
**	Resets the logfail count on the specified account.
**      Requires write access to SYSUAF.DAT via sys$setuai.
**
**  Author:
**	Stephen Hoffman
**      OpenVMS Engineering
**
**  Creation Date:  29-Oct-1998
**
**  Modification History:
**
**
*/
 
#pragma module LOGFAIL_SETUAI "V1.0-000"
 
/*
**      To build and to reset the default account to zero:
**
**      $ CC/DECC LOGFAIL_SETUAI
**      $ LINK LOGFAIL_SETUAI
**      $ LF :== $SYS$DISK:[]LOGFAIL_SETUAI
**      $ LF DEFAULT 0
**
*/
 
#include {descrip.h}
#include {ssdef.h}
#include {starlet.h}
#include {stdio.h}
#include {string.h}
#include {stsdef.h}
#include {uaidef.h}
#include {unixlib.h}
 
struct ItemList3
    {
    short int ItemLength;
    short int ItemCode;
    void *ItemBuffer;
    void *ItemRetLen;
    };
 
#ifndef UAF$S_USERNAME
#define UAF$S_USERNAME 32
#endif
 
main( int argc, char **argv )
    {
    int RetStat;
    struct ItemList3 ItmLst[10];
    char Username[UAF$S_USERNAME];
    struct dsc$descriptor UsernameDsc =
      { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
    int i;
    int LogFailCount = 0;
 
    if (( argc != 2 ) &amp;&amp; ( argc != 3 ))
	{
	printf("usage: %s username count\n", argv[0] );
	printf("  username is required.\n");
	printf("  count defaults to zero.\n");
	printf("this is a foreign command.\n");
	return SS$_BADPARAM;
	}
 
    sscanf( argv[1], "%s", Username );
    if ( argc == 3 )
      sscanf( argv[2], "%d", &amp;LogFailCount );
 
    LogFailCount &amp;= 0x0ffff;
    UsernameDsc.dsc$w_length = strlen( Username );
    UsernameDsc.dsc$a_pointer = Username;
 
    printf("Resetting username %s to %d logfails.\n", Username, LogFailCount );
 
    i = 0;
    ItmLst[i].ItemLength    = sizeof(short int);
    ItmLst[i].ItemCode	    = UAI$_LOGFAILS;
    ItmLst[i].ItemBuffer    = (void *) &amp;LogFailCount;
    ItmLst[i++].ItemRetLen  = NULL;
    ItmLst[i].ItemLength    = 0;
    ItmLst[i].ItemCode	    = 0;
    ItmLst[i].ItemBuffer    = NULL;
    ItmLst[i++].ItemRetLen  = NULL;
 
    RetStat = sys$setuai( 0, 0, &amp;UsernameDsc, ItmLst, 0, 0, 0);
    if (!$VMS_STATUS_SUCCESS( RetStat ))
	return RetStat;
 
    return SS$_NORMAL;
    }
 Answer written or last revised on  15-JAN-2003 
