Cover V05, I02
Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Listing 1

feb96.tar


Listing 1: checkpwd.c

/*
** Password extension function.
**
** Function must have the interface
**     char *user - User name for which invoked
**     char *new - New password in clear text
**     char *old - Old password in clear text
**     char **message - Error Message, must be allocated from heap.
**        Caller will call free().
**
** Compile with
**     cc -e checkpwd -o checkpwd checkpwd
**
** Return false when password contains userid, otherwise return true.
*/

#include     <string.h>

int checkpwd(char *user, char *new, char *old, char **message)
{
char *error = "Userid must not be part of password\n";

*message = NULL;
if( strstr(new, user) == NULL )
return 0;

*message = strdup(error);
return 1;
}

/* End of File */