Súbor: [Platon] / libplaton / utils / crypt / crypt.c (stiahnutie)
Revízia 1.4, Tue Mar 16 19:44:38 2004 UTC (19 years, 6 months ago) by rajo
Zmeny od 1.3: +6 -6
[lines]
Changed email address from <8host AT pauli.fmph.uniba.sk> to <rajo AT platon.sk>
|
/*
* Platon SDG (http://platon.sk/) CVS encrypted password creator
* =============================================================
*
* If you are using this software you are probably requesting CVS
* account on kepler.fmph.uniba.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 SDG CVS server administrator:
*
* Lubomir Host <rajo AT 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@pobox.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 AT platon.sk>
* and Ondrej Jombik <nepto AT platon.sk>
*
* Copyright (c) 2000-2003 Platon SDG, http://platon.sk/
* Licensed under terms of GNU General Public License.
*/
#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/
|