Refer to FAQ some part of it didn't compile
$ gcc source.cCode://Test a plain text password against an /etc/passwd entry #include <sys/types.h> #include <pwd.h> #include <unistd.h> int main() { struct passwd *p; p=getpwnam(getlogin()); if (p) if (strcmp((char*)crypt("password",p->pw_passwd),p->pw_passwd)==0) puts("match"); else puts("not match"); return 0; }
/tmp/ccmmZota.o: In function `main':
/tmp/ccmmZota.o(.text+0x42): undefined reference to `crypt'
collect2: ld returned 1 exit status
comment: I modified some part i.e. I cast crypt() to (char *), else more error would be generated.



LinkBack URL
About LinkBacks


