DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T v

⟦59477ef68⟧ TextFile

    Length: 848 (0x350)
    Types: TextFile
    Names: »validname.c«

Derivation

└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
    └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/elm/src/validname.c« 

TextFile

/**			validname.c			**/

/** This routine takes a single address, no machine hops or
    anything, and returns 1 if it's valid and 0 if not.  The
    algorithm it uses is the same one that uux uses, namely:

	1. Is there a file '/usr/mail/%s'?  
	2. Is there a password entry for %s?
	
   (C) Copyright 1986 Dave Taylor 
**/

#include "defs.h"

#include <stdio.h>

#ifndef NOCHECK_VALIDNAME
#  ifdef BSD4.1
#    include <sys/pwd.h>
#  else
#    include <pwd.h>
#  endif
#endif

int
valid_name(name)
char *name;
{
	/** does what it says above, boss! **/

#ifdef NOCHECK_VALIDNAME

	return(1);		/* always say it's okay! */

#else
	struct passwd *getpwname();
	char filebuf[SLEN];

	sprintf(filebuf,"%s/%s", mailhome, name);
	
	if (access(filebuf, ACCESS_EXISTS) == 0)
	  return(1);

	if (getpwnam(name) != NULL)
	  return(1);

	return(0);

#endif

}