summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-10-19 15:29:51 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2007-10-19 15:29:51 -0700
commit61514272a6ad4ca2c9dec0ec97005b13022bcc7e (patch)
tree5b667996aaae0e98b4c64156ba33522ab560a237
parentb906b7563529d504c1884f01b9e37374e64653ea (diff)
downloadvyatta-cfg-61514272a6ad4ca2c9dec0ec97005b13022bcc7e.tar.gz
vyatta-cfg-61514272a6ad4ca2c9dec0ec97005b13022bcc7e.zip
replace "rl_passwd" with the standard "mkpasswd".
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac2
-rw-r--r--tools/rl_passwd.cc152
3 files changed, 0 insertions, 156 deletions
diff --git a/Makefile.am b/Makefile.am
index e703e58..d7186e9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,11 +22,9 @@ LDADD = src/libvyatta-cfg.la
sbin_PROGRAMS = src/my_commit
sbin_PROGRAMS += src/my_delete
sbin_PROGRAMS += src/my_set
-sbin_PROGRAMS += tools/rl_passwd
src_my_commit_SOURCES = src/commit.c
src_my_delete_SOURCES = src/delete.c
src_my_set_SOURCES = src/set.c
-tools_rl_passwd_SOURCES = tools/rl_passwd.cc
sbin_SCRIPTS = scripts/xorp_tmpl_tool
sbin_SCRIPTS += scripts/vyatta-validate-type.pl
diff --git a/configure.ac b/configure.ac
index 4e344f2..cc7a15a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,8 +22,6 @@ AC_PROG_LIBTOOL
AC_PROG_LEX
AC_PROG_YACC
-AC_CHECK_LIB(crypt, crypt, [ LIBS="$LIBS -lcrypt" ])
-
AC_ARG_ENABLE([nostrip],
AC_HELP_STRING([--enable-nostrip],
[include -nostrip option during packaging]),
diff --git a/tools/rl_passwd.cc b/tools/rl_passwd.cc
deleted file mode 100644
index 5a5610b..0000000
--- a/tools/rl_passwd.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Module: rl_passwd.cc
- *
- * **** License ****
- * Version: VPL 1.0
- *
- * The contents of this file are subject to the Vyatta Public License
- * Version 1.0 ("License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.vyatta.com/vpl
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * This code was originally developed by Vyatta, Inc.
- * Portions created by Vyatta are Copyright (C) 2005, 2006, 2007 Vyatta, Inc.
- * All Rights Reserved.
- *
- * Author: Michael Larson
- * Date: 2005
- * Description:
- *
- * **** End License ****
- *
- */
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <utime.h>
-#include <syslog.h>
-#include <time.h>
-#include <sys/types.h>
-#include <shadow.h>
-#include <pwd.h>
-#include <sys/resource.h>
-#include <errno.h>
-
-static char crypt_passwd[128];
-
-static int new_password(char * password);
-static char *pw_encrypt(const char *clear, const char *salt);
-
-void usage()
-{
- printf("vyatta_pwd plainpwd username\n");
-
-}
-
-int main(int argc, char **argv)
-{
- char *name;
- char * password;
-
- if (argc != 3) {
- usage();
- return(1);
- }
-
- /* "name" is unused */
- name = argv[2];
- password = argv[1];
-
- if (new_password(password)) {
- printf("error in password encrypt\n");
- return(1);
- }
- // printf("%s, %s\n",name,password);
- printf("%s",crypt_passwd);
- return (0);
-}
-
-
-
-static int i64c(int i)
-{
- if (i <= 0)
- return ('.');
- if (i == 1)
- return ('/');
- if (i >= 2 && i < 12)
- return ('0' - 2 + i);
- if (i >= 12 && i < 38)
- return ('A' - 12 + i);
- if (i >= 38 && i < 63)
- return ('a' - 38 + i);
- return ('z');
-}
-
-static char *crypt_make_salt(void)
-{
- time_t now;
- static unsigned long x;
- static char result[3];
-
- time(&now);
- x += now + getpid() + clock();
- result[0] = i64c(((x >> 18) ^ (x >> 6)) & 077);
- result[1] = i64c(((x >> 12) ^ x) & 077);
- result[2] = '\0';
- return result;
-}
-
-
-static int new_password(char * password)
-{
- char *cp;
- char salt[12]; /* "$N$XXXXXXXX" or "XX" */
- char orig[200];
- char pass[200];
-
- orig[0] = '\0';
-
- cp = (char*)password;
-
- strncpy(pass, cp, sizeof(pass));
- memset(cp, 0, strlen(cp));
- memset(cp, 0, strlen(cp));
- memset(orig, 0, sizeof(orig));
- memset(salt, 0, sizeof(salt));
-
- strcpy(salt, "$1$");
- strcat(salt, crypt_make_salt());
- strcat(salt, crypt_make_salt());
- strcat(salt, crypt_make_salt());
-
- strcat(salt, crypt_make_salt());
- cp = pw_encrypt(pass, salt);
-
- memset(pass, 0, sizeof pass);
- strncpy(crypt_passwd, cp, sizeof(crypt_passwd));
- return 0;
-}
-
-char *pw_encrypt(const char *clear, const char *salt)
-{
- static char cipher[128];
- char *cp;
- cp = (char *) crypt(clear, salt);
- /* if crypt (a nonstandard crypt) returns a string too large,
- truncate it so we don't overrun buffers and hope there is
- enough security in what's left */
- strncpy(cipher, cp, sizeof(cipher));
- return cipher;
-}
-