Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:27

0001 /*
0002  * Authorship
0003  * ----------
0004  * This software was created by
0005  *     Till Straumann <strauman@slac.stanford.edu>, 2003-2007
0006  *     Stanford Linear Accelerator Center, Stanford University.
0007  *
0008  * Acknowledgement of sponsorship
0009  * ------------------------------
0010  * This software was produced by
0011  *     the Stanford Linear Accelerator Center, Stanford University,
0012  *     under Contract DE-AC03-76SFO0515 with the Department of Energy.
0013  *
0014  * Government disclaimer of liability
0015  * ----------------------------------
0016  * Neither the United States nor the United States Department of Energy,
0017  * nor any of their employees, makes any warranty, express or implied, or
0018  * assumes any legal liability or responsibility for the accuracy,
0019  * completeness, or usefulness of any data, apparatus, product, or process
0020  * disclosed, or represents that its use would not infringe privately owned
0021  * rights.
0022  *
0023  * Stanford disclaimer of liability
0024  * --------------------------------
0025  * Stanford University makes no representations or warranties, express or
0026  * implied, nor assumes any liability for the use of this software.
0027  *
0028  * Stanford disclaimer of copyright
0029  * --------------------------------
0030  * Stanford University, owner of the copyright, hereby disclaims its
0031  * copyright and all other rights in this software.  Hence, anyone may
0032  * freely use it for any purpose without restriction.
0033  *
0034  * Maintenance of notices
0035  * ----------------------
0036  * In the interest of clarity regarding the origin and status of this
0037  * SLAC software, this and all the preceding Stanford University notices
0038  * are to remain affixed to any copy or derivative of this software made
0039  * or distributed by the recipient and are to be affixed to any copy of
0040  * software made or distributed by the recipient that contains a copy or
0041  * derivative of this software.
0042  *
0043  * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
0044  */
0045 
0046 #ifdef HAVE_CONFIG_H
0047 #include "config.h"
0048 #endif
0049 
0050 #include <crypt.h>
0051 #include <stdio.h>
0052 #include <unistd.h>
0053 
0054 static void
0055 usage(char *nm)
0056 {
0057   fprintf(stderr,"Usage: %s [-h] [-s salt] cleartext_password\n", nm);
0058 }
0059 
0060 int
0061 main(int argc, char **argv)
0062 {
0063 int ch;
0064 char *salt="td";
0065   while ( (ch=getopt(argc, argv, "hs:")) >=0 ) {
0066     switch (ch) {
0067       default:  fprintf(stderr,"Unknown Option '%c'\n",ch);
0068       case 'h': usage(argv[0]);
0069       return 0;
0070       case 's': salt=optarg;
0071       break;
0072     }
0073   }
0074   if ( optind >= argc ) {
0075     usage(argv[0]);
0076     return 1;
0077   }
0078   printf("#define TELNETD_DEFAULT_PASSWD \"%s\"\n",crypt(argv[optind],salt));
0079 }