DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

smp_get_messages(S)


smp_get_messages -- return login messages

Syntax

cc . . . -lprot
#include <sys/types.h>
#include <prot.h>

int smp_get_messages(userp, successp, unsuccessp, reasonp) struct smp_user_info *userp; char **successp; char **unsuccessp; char **reasonp;

Description

smp_get_messages builds the last successful and last unsuccessful login or password change messages ready for display by the calling program, setting successp and unsuccessp respectively to point to them. For logins, it should be called following smp_set_identity(S). For password changes, it should be called immediately before smp_pw_choice(S).

reasonp is used with certain return values to store a descriptive message.

Return values

Note that this routine also stores its return value for later use in auditing of failures.

SMP_HUSHLOGIN
This is a login operation, and the hushlogin feature is set for this user - no messages are built in this case.

SMP_FAIL
No memory was available to store the generated strings.

SMP_EXTFAIL
External failure - access to remote authentication information failed. reasonp points to a character string explaining the cause of the error.

SMP_COMPLETE
The messages were successfully built.

Diagnostics

Normally, all diagnostics are returned as strings pointed to by the argument reasonp. However, in the current implementation no diagnostic messages are returned.

Examples

The following example illustrates the usage of smp_check_user :
...
    switch (smp_check_user(SMP_LOGIN, gets(line), ttyname(0), 0, &userp,
                               &pwtries, &reason)) {
    ...
    }
    switch (smp_set_identity(userp, &reason, &environ, &shell)) {
    ... 
    }

    /* display last login messages */
    {   char *success, *unsuccess;;
        switch (smp_get_messages(userp, &success, &unsuccess, &reason)) {
        case SMP_FAIL:
            put("out of memory\n");
            exit(1);
        case SMP_HUSHLOGIN:
            break;
        case SMP_COMPLETE:
            put(success);
            put("\n");
            put(unsuccess);
            put("\n");
            put("Copyright 1992-1995 The Santa Cruz Operation, Inc.\n");
	    break;
	case SMP_EXTFAIL:
	    put(reason);
	    exit(1);
        }
    }
...

Files


/lib/libprot.a
security subsystem library routines

/usr/lib/libp/libprot.a
as above but used for profiling

/usr/include/prot.h
defines the smp_user_info structure

See also

smp_check_user(S), smp_check_pw(S), smp_generate_pw(S), smp_pw_change(S), smp_pw_choice(S), smp_set_identity(S), smp_set_pw(S), smp_try_pw(S)

Standards conformance

smp_get_messages is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003