Súbor: [Platon] / libplaton / utils / crypt / crypt.c (stiahnutie)
Revízia 1.6, Sun Aug 13 20:45:08 2006 UTC (17 years, 8 months ago) by nepto
Zmeny od 1.5: +11 -11 [lines]
Fixed Platon SDG to Platon Group and other changes as well
|
/*
* Platon Group (http://platon.sk/) CVS encrypted password creator
* ===============================================================
*
* If you are using this software you are probably requesting CVS
* account on cvs.platon.sk development server. In this case just
* compile this file with following command:
*
* gcc -lcrypt -pedantic -Wall -o crypt crypt.c
*
* Run this utility (ie. by typing ./crypt) and enter password that you
* want to use for accessing your CVS account. Now copy and paste your
* encrypted password what should appear on output screen and send it
* to Platon Group CVS server administrator:
*
* Lubomir Host <rajo@platon.sk>
*
* Do not forget to write also username you want to use. Don't forget
* also to use his GnuPG public key. You should recieve it via e-mail
* or it should be attached to this program. If you either don't have
* it, you can download it from following URL:
*
* http://rajo.platon.sk/gpg.key
*
* You can import GnuPG key directly with command:
*
* GET http://rajo.platon.sk/gpg.key | gpg --import
* or
* wget -O - http://rajo.platon.sk/gpg.key | gpg --import
*
* If some problem occurs or you have some question, don't hesitate
* to contact us at this e-mail address:
*
* <platon@platon.sk>
*
* That's all folks for now! Thank you for your interest and we are
* looking for productive cooperation.
*
* Utility developed and procedure written
* by Lubomir Host <rajo@platon.sk>
* and Ondrej Jombik <nepto@platon.sk>
*
* Copyright (c) 2000-2006 Platon Group, http://platon.sk/
* Licensed under terms of GNU General Public License.
*/
/* $Platon: libplaton/utils/crypt/crypt.c,v 1.5 2004/03/16 20:29:17 nepto Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#define _XOPEN_SOURCE
#include <unistd.h>
#define KEYBD_LEN 4096
/* KEY -- 2 characters, you can modify it as you like */
#define KEY "Gr"
char *crypt(const char *key, const char *salt);
int main(void)
{
char *passwd[2];
if ( (passwd[1] = getpass("Password: ")) == NULL
|| (passwd[1] = strdup(passwd[1])) == NULL
|| (passwd[0] = getpass("Verification: ")) == NULL)
{
if (passwd[1] != NULL)
free(passwd[1]);
fputs("Memory allocation failure\n", stderr);
return 8;
}
if (strcmp(passwd[0], passwd[1])) {
free(passwd[1]);
fputs("Passwords do not match\n", stderr);
return 4;
}
free(passwd[1]);
if (strlen(passwd[0]) <= 0) {
fputs("Empty passwords are not allowed\n", stderr);
return 2;
}
puts("Your encrypted password follows on next line:");
puts(crypt(passwd[0], KEY));
return 0;
}
/* vim:set ts=4 */
Platon Group <platon@platon.sk> http://platon.sk/
|