General cleanup of old and ugly code.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@235 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Unknown User d91-jda
1996-02-07 10:48:34 +00:00
parent 3c9ccd124c
commit 55db31afbe
12 changed files with 331 additions and 165 deletions

View File

@@ -3,6 +3,7 @@
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include "des_locl.h"
extern int LEFT_JUSTIFIED;

View File

@@ -44,11 +44,6 @@ struct IOSB {
#define NSIG 32
#endif
static void read_till_nl();
static int read_pw();
static void recsig();
static void pushsig();
static void popsig();
#ifdef MSDOS
static int noecho_fgets();
#endif
@@ -56,69 +51,43 @@ static int noecho_fgets();
static void (*savsig[NSIG])();
static jmp_buf save;
int des_read_password(key,prompt,verify)
des_cblock *key;
char *prompt;
int verify;
{
int ok;
char buf[BUFSIZ],buff[BUFSIZ];
static void recsig(int sig)
{
longjmp(save,1);
}
if ((ok=read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
des_string_to_key(buf,key);
bzero(buf,BUFSIZ);
bzero(buff,BUFSIZ);
return(ok);
}
static void pushsig(void)
{
int i;
int des_read_2passwords(key1,key2,prompt,verify)
des_cblock *key1;
des_cblock *key2;
char *prompt;
int verify;
{
int ok;
char buf[BUFSIZ],buff[BUFSIZ];
for (i=0; i<NSIG; i++)
savsig[i]=signal(i,recsig);
}
if ((ok=read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
des_string_to_2keys(buf,key1,key2);
bzero(buf,BUFSIZ);
bzero(buff,BUFSIZ);
return(ok);
}
static void popsig(void)
{
int i;
int des_read_pw_string(buf,length,prompt,verify)
char *buf;
int length;
char *prompt;
int verify;
{
char buff[BUFSIZ];
int ret;
for (i=0; i<NSIG; i++)
signal(i,savsig[i]);
}
ret=read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify);
bzero(buff,BUFSIZ);
return(ret);
}
static void read_till_nl(in)
FILE *in;
{
static void read_till_nl(FILE *in)
{
#define SIZE 4
char buf[SIZE+1];
do {
fgets(buf,SIZE,in);
} while (strchr(buf,'\n') == NULL);
}
} while (strchr(buf,'\n') == NULL);
}
/* return 0 if ok, 1 (or -1) otherwise */
static int read_pw(buf,buff,size,prompt,verify)
char *buf,*buff;
int size;
char *prompt;
int verify;
{
static int read_pw(char *buf, char *buff, int size, char *prompt,int verify)
{
#ifndef VMS
#ifndef MSDOS
struct sgttyb tty_orig,tty_new;
@@ -235,27 +204,52 @@ error:
return(!ok);
}
static void pushsig()
int des_read_password(key,prompt,verify)
des_cblock *key;
char *prompt;
int verify;
{
int i;
int ok;
char buf[BUFSIZ],buff[BUFSIZ];
for (i=0; i<NSIG; i++)
savsig[i]=signal(i,recsig);
if ((ok=read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
des_string_to_key(buf,key);
bzero(buf,BUFSIZ);
bzero(buff,BUFSIZ);
return(ok);
}
static void popsig()
int des_read_2passwords(key1,key2,prompt,verify)
des_cblock *key1;
des_cblock *key2;
char *prompt;
int verify;
{
int i;
int ok;
char buf[BUFSIZ],buff[BUFSIZ];
for (i=0; i<NSIG; i++)
signal(i,savsig[i]);
if ((ok=read_pw(buf,buff,BUFSIZ,prompt,verify)) == 0)
des_string_to_2keys(buf,key1,key2);
bzero(buf,BUFSIZ);
bzero(buff,BUFSIZ);
return(ok);
}
static void recsig()
int des_read_pw_string(buf,length,prompt,verify)
char *buf;
int length;
char *prompt;
int verify;
{
longjmp(save,1);
char buff[BUFSIZ];
int ret;
ret=read_pw(buf,buff,(length>BUFSIZ)?BUFSIZ:length,prompt,verify);
bzero(buff,BUFSIZ);
return(ret);
}
#ifdef MSDOS
static int noecho_fgets(buf,size,tty)
char *buf;

View File

@@ -4,7 +4,11 @@
#include <sys/time.h>
#include <unistd.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@@ -23,7 +27,7 @@ static u_int32_t sequence_index[2];
static int initialized;
static des_cblock default_seed = {0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef};
static void
do_initialize()
do_initialize(void)
{
des_set_odd_parity(&default_seed);
des_set_random_generator_seed(&default_seed);

View File

@@ -14,6 +14,8 @@ RCSID("$Header$");
#include <signal.h>
#include <setjmp.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <krb.h>
#include <kafs.h>
@@ -31,8 +33,7 @@ RCSID("$Header$");
#define ToAsciiUpper(c) ((c) - 'a' + 'A')
static void
foldup(a, b)
char *a, *b;
foldup(char *a, char *b)
{
for (; *b; a++, b++)
if (IsAsciiLower(*b))
@@ -45,7 +46,7 @@ foldup(a, b)
#define _PATH_THISCELL "/usr/vice/etc/ThisCell"
static char *
k_cell()
k_cell(void)
{
static char cell[64];
@@ -245,7 +246,7 @@ k_setpag(void)
static jmp_buf catch_SIGSYS;
static void
SIGSYS_handler()
SIGSYS_handler(int sig)
{
errno = 0;
signal(SIGSYS, SIGSYS_handler); /* Need to reinstall handler on SYSV */

View File

@@ -4,11 +4,11 @@
* This section is for machines using multiple entry point AFS syscalls!
*/
#if defined(sun) && !defined(__svr4__)
#if SunOS == 4
#define AFS_SYSCALL 31
#endif
#if defined(sun) && defined(__svr4__)
#if SunOS == 5
#define AFS_SYSCALL 105
#endif