Add missing program to generate encrypted passwords using blowfish

with 8 rounds by default.
This commit is contained in:
fgsch 2000-08-29 03:40:35 +00:00
parent 1e6c749a2d
commit 17bee8a9a8
5 changed files with 113 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.1.1.1 2000/08/28 16:14:20 fgsch Exp $
# $OpenBSD: Makefile,v 1.2 2000/08/29 03:40:35 fgsch Exp $
DISTNAME= icecast-1.3.7
CATEGORIES= audio net www
@ -20,6 +20,9 @@ CONFIGURE_ARGS+= --with-crypt
DOCFILES= AUTHORS BUGS CHANGES COPYING FAQ README
post-patch:
@cp ${FILESDIR}/icepass.c ${WRKSRC}/src
post-install:
@rm -f ${PREFIX}/share/icecast/templates/manual.html
@rmdir ${PREFIX}/share/icecast/static

View File

@ -0,0 +1,51 @@
/* $OpenBSD: icepass.c,v 1.1 2000/08/29 03:40:36 fgsch Exp $ */
/*
* Create an encrypted password to use in icecast.conf, users.aut and
* command line when running the icecast server.
* The encription algorithm is blowfish, with 8 rounds by default.
*
* The number of rounds might be specified in command line.
*
* Tue Aug 29 00:06:28 ART 2000, -fgsch
*/
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
int
main(argc, argv)
int argc;
char **argv;
{
char *p, salt[_PASSWORD_LEN];
int rounds = 8;
if (argc > 1) {
char *ep;
if (!strcmp(argv[1], "-h")) {
fprintf(stderr, "usage: icepass [rounds]\n");
exit (1);
}
rounds = strtol(argv[1], &ep, 10);
if (argv[1] == '\0' || *ep != '\0' || rounds < 4)
rounds = 4;
}
strncpy(salt, bcrypt_gensalt(rounds), _PASSWORD_LEN - 1);
salt[_PASSWORD_LEN - 1] = 0;
p = crypt(getpass("Password:"), salt);
if (p)
printf("Encrypted password: %s\n", p);
else
printf("Error encrypting password\n");
return (0);
}

View File

@ -0,0 +1,32 @@
$OpenBSD: patch-crypt,v 1.1 2000/08/29 03:40:36 fgsch Exp $
--- src/utility.c.orig Wed Jul 5 16:52:40 2000
+++ src/utility.c Mon Aug 28 23:06:20 2000
@@ -102,7 +102,6 @@
return 0;
#else
- char salt[3];
char *test_crypted;
extern char *crypt(const char *, const char *);
@@ -111,18 +110,8 @@
return 0;
}
- if (ice_strncmp(crypted, "$1$", 3)) {
- salt[0] = crypted[0];
- salt[1] = crypted[1];
- } else {
- salt[0] = crypted[3];
- salt[1] = crypted[4];
- }
-
- salt[2] = '\0';
-
thread_mutex_lock(&info.misc_mutex);
- test_crypted = crypt(uncrypted, salt);
+ test_crypted = crypt(uncrypted, crypted);
if (test_crypted == NULL) {
write_log(LOG_DEFAULT, "WARNING - crypt() failed, refusing access");
thread_mutex_unlock(&info.misc_mutex);

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-icepass,v 1.1 2000/08/29 03:40:36 fgsch Exp $
--- src/Makefile.in.orig Wed Jul 5 17:44:54 2000
+++ src/Makefile.in Tue Aug 29 00:12:50 2000
@@ -83,7 +83,7 @@
SUBDIRS = authenticate
-bin_PROGRAMS = icecast
+bin_PROGRAMS = icecast icepass
noinst_HEADERS = admin.h alias.h avl.h avl_functions.h client.h definitions.h commandline.h commands.h connection.h dir.h directory.h globals.h http.h ice_string.h icecast.h icetypes.h log.h logtime.h main.h match.h memory.h relay.h restrict.h sock.h source.h static.h threads.h timer.h utility.h vars.h ice_resolv.h item.h pool.h interpreter.h
@@ -187,6 +187,10 @@
icecast: $(icecast_OBJECTS) $(icecast_DEPENDENCIES)
@rm -f icecast
$(LINK) $(icecast_LDFLAGS) $(icecast_OBJECTS) $(icecast_LDADD) $(LIBS)
+
+icepass: icepass.o
+ @rm -f icepass
+ $(LINK) icepass.o
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.

View File

@ -1,5 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2000/08/28 16:14:21 fgsch Exp $
@comment $OpenBSD: PLIST,v 1.2 2000/08/29 03:40:36 fgsch Exp $
bin/icecast
bin/icepass
share/doc/icecast/AUTHORS
share/doc/icecast/BUGS
share/doc/icecast/CHANGES