/*
 *
 *	Copyright (C) 1988, 1989 by the Massachusetts Institute of Technology
 *    	Developed by the MIT Student Information Processing Board (SIPB).
 *    	For copying information, see the file mit-copyright.h in this release.
 *
 */
/*
 *
 * auth_weak () -- Authentication procedure for non-kerberos sites.
 *		   Just returns the username.
 *
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */

#include <sys/types.h>
#include <string.h>
#include <pwd.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <discuss/rpc.h>

int auth_type = AUTH_WEAK;

get_authenticator (service_id, checksum, authp, authl, result)
char *service_id;
int checksum;
char **authp;
int *authl;
int *result;
{
    static struct passwd *pwent;
    int uid;

    uid = getuid ();
    pwent = getpwuid(uid);

    if (pwent != 0) {
	 *authp = pwent -> pw_name;
	 *authl = strlen(pwent -> pw_name)+1;
    } else {
	 *authp = "";
	 *authl = 0;
    }
    *result = 0;
    return;
}
