Back to index

wims  3.65+svn20090927
Defines | Functions | Variables
passcrypt.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <ctype.h>
#include "../config.h"

Go to the source code of this file.

Defines

#define MAX_LINELEN   1024

Functions

void pcrypt (char *p)
int main (int argc, char *argv[])

Variables

int salt
char schar [] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"

Define Documentation

#define MAX_LINELEN   1024

Definition at line 20 of file passcrypt.c.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 54 of file passcrypt.c.

{
    int salt1;
    char p[MAX_LINELEN+1];

#ifdef HAVE_GETTIMEOFDAY
    struct timeval tv;
    gettimeofday(&tv,NULL); salt1=tv.tv_sec+tv.tv_usec;
#else
    salt1=3219;
#endif
    if(argc<1) return 1;
    srandom(salt1+getpid());
    salt=random()/101;
    snprintf(p,sizeof(p),"%s",argv[1]);
    pcrypt(p); printf("%s\n",p);
    
    return 0;
}

Here is the call graph for this function:

void pcrypt ( char *  p)

Definition at line 39 of file passcrypt.c.

{
#ifdef HAVE_CRYPT
    char saltstr[4];
    char *pp, buf[MAX_LINELEN+1];
    saltstr[0]=schar[salt%64];
    saltstr[1]=schar[(salt/64)%64];
    saltstr[2]=0;
    while(isspace(*p)) p++;
    for(pp=p+strlen(p); pp>p && isspace(*(pp-1)); pp--); *pp=0;
    snprintf(buf,sizeof(buf),"%s",crypt(p,saltstr));
    strcpy(p,buf);
#endif
}

Here is the caller graph for this function:


Variable Documentation

int salt

Definition at line 36 of file passcrypt.c.

char schar[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"

Definition at line 37 of file passcrypt.c.