![]() |
|
|||
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 * Copyright (c) 2009 embedded brains GmbH & Co. KG 0046 * 0047 * The license and distribution terms for this file may be 0048 * found in the file LICENSE in this distribution or at 0049 * http://www.rtems.org/license/LICENSE. 0050 */ 0051 0052 #ifdef HAVE_CONFIG_H 0053 #include "config.h" 0054 #endif 0055 0056 #include <termios.h> 0057 #include <errno.h> 0058 #include <stdio.h> 0059 #include <unistd.h> 0060 #include <stdlib.h> 0061 #include <string.h> 0062 #include <syslog.h> 0063 0064 #include <rtems/telnetd.h> 0065 0066 #include "des.h" 0067 #include <rtems/passwd.h> 0068 0069 /** 0070 * @brief Standard Telnet login check that uses DES to encrypt the passphrase. 0071 * 0072 * Takes a @a passphrase, encrypts it and compares it to the encrypted 0073 * passphrase in the @c TELNETD_PASSWD environment variable. No password is 0074 * required if @c TELNETD_PASSWD is unset. The argument @a user is ignored. 0075 */ 0076 bool rtems_telnetd_login_check( 0077 const char *user, 0078 const char *passphrase 0079 ) 0080 { 0081 char *pw = getenv( "TELNETD_PASSWD"); 0082 char cryptbuf [21]; 0083 char salt [3]; 0084 0085 if (pw == NULL || strlen( pw) == 0) { 0086 #ifdef TELNETD_DEFAULT_PASSWD 0087 pw = TELNETD_DEFAULT_PASSWD; 0088 #else 0089 return true; 0090 #endif 0091 } 0092 0093 strncpy( salt, pw, 2); 0094 salt [2] = '\0'; 0095 0096 return strcmp( 0097 __des_crypt_r( passphrase, salt, cryptbuf, sizeof( cryptbuf)), 0098 pw 0099 ) == 0; 0100 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |