Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Apr 1998 10:23:02 +0400
From:      "Denis V. Talonin" <dio@ax.ru>
To:        "Leon Felipe Rodriguez J. -CENCAR" <leonf@osiris.staff.udg.mx>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Undefined symbol `_crypt' referenced from text segment
Message-ID:  <353EDE46.44FA7934@ax.ru>
References:  <9804221117.ZM29375@osiris.staff.udg.mx>

next in thread | previous in thread | raw e-mail | index | archive | help


Leon Felipe Rodriguez J. -CENCAR wrote:

> Hi!!!
>
> i'm working on web design and I need to create encripted passwors, I tried with
> a modified version of NCSA htpasswd program:
>
> genpass.c
>
> # more genpass.c
> /*
>  * htpasswd.c: simple program for manipulating password file for NCSA httpd
>  *
>  */
>
> #include <sys/types.h>
> #include <stdio.h>
> #include <string.h>
> #include <sys/signal.h>
> #include <stdlib.h>
> #include <time.h>
>
> #define LF 10
> #define CR 13
>
> #define MAX_STRING_LEN 256
>
> char *tn;
>
> /* From local_passwd.c (C) Regents of Univ. of California blah blah */
> static unsigned char itoa64[] =         /* 0 ... 63 => ascii - 64 */
>         "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
>
> to64(s, v, n)
>   register char *s;
>   register long v;
>   register int n;
> {
>     while (--n >= 0) {
>         *s++ = itoa64[v&0x3f];
>         v >>= 6;
>     }
> }
>
> char *crypt(char *pw, char *salt); /* why aren't these prototyped in include */
>
> void add_password(char *user,char *pw) {
>     char *cpw, *pru, salt[3];
>
>     (void)srand((int)time((time_t *)NULL));
>     to64(&salt[0],rand(),2);
>     cpw = crypt(pw,salt);
>     printf("%s",cpw);
> }
> main(int argc, char *argv[]) {
>     char user[MAX_STRING_LEN];
>     char line[MAX_STRING_LEN];
>     char l[MAX_STRING_LEN];
>     char w[MAX_STRING_LEN];
>     char command[MAX_STRING_LEN];
>     int found;
>
>     tn = NULL;
>     add_password(argv[1],argv[2]);
> }
>
> but i get this mesg
>
> gcc -o genpass genpass.c
> /var/tmp/cc0159851.o: Undefined symbol `_crypt' referenced
>
> any idea?

gcc -o genpass -lcrypt genpass.c

Denis V. Talonin

>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?353EDE46.44FA7934>