Subject: lib/1105: compile warnings in skey library
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Thorsten Lockert <tholo@SigmaSoft.COM>
List: netbsd-bugs
Date: 06/03/1995 22:05:09
>Number:         1105
>Category:       lib
>Synopsis:       compile warnings in skey library
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun  3 22:05:04 1995
>Originator:     Thorsten Lockert
>Organization:
SigmaSoft, Th. Lockert
>Release:        May 28, 1995
>Environment:
	
System: NetBSD gandalf.sigmasoft.com 1.0A NetBSD 1.0A (GANDALF) #1: Sun May 7 21:49:27 PDT 1995 tholo@gandalf.sigmasoft.com:/usr/src/sys/arch/i386/compile/GANDALF i386


>Description:
	There are compile warnings in the skey library when compiled with
	-Wall -Wstrict-prototypes

>How-To-Repeat:
	Compile with -Wall -Wstrict-prototypes

>Fix:
	Apply the following patches:

diff -c src/lib/libskey.orig/md4.c src/lib/libskey/md4.c
*** src/lib/libskey.orig/md4.c	Tue May 30 05:33:37 1995
--- src/lib/libskey/md4.c	Sat Jun  3 21:25:33 1995
***************
*** 56,61 ****
--- 56,63 ----
  #include <machine/endian.h>
  #include "md4.h"
  
+ static void MDblock __ARGS((MDptr, unsigned long *));
+ 
  /* Compile-time declarations of MD4 ``magic constants'' */
  #define I0  0x67452301       /* Initial values for MD buffer */
  #define I1  0xefcdab89
Only in src/lib/libskey: obj
diff -c src/lib/libskey.orig/skey.h src/lib/libskey/skey.h
*** src/lib/libskey.orig/skey.h	Tue May 30 05:33:39 1995
--- src/lib/libskey/skey.h	Sat Jun  3 21:48:16 1995
***************
*** 61,63 ****
--- 61,71 ----
  int skeychallenge __ARGS ((struct skey * mp, char *name, char *ss));
  int skeylookup __ARGS ((struct skey * mp, char *name));
  int skeyverify __ARGS ((struct skey * mp, char *response));
+ void sevenbit __ARGS ((char *s));
+ char *readpass __ARGS ((char *buf, int n));
+ char *readskey __ARGS ((char *buf, int n));
+ int skey_authenticate __ARGS ((char *));
+ int skey_passcheck __ARGS ((char *, char *));
+ char *skey_keyinfo __ARGS ((char *));
+ int skey_haskey __ARGS ((char *));
+ int getskeyprompt __ARGS ((struct skey *, char *, char *));
diff -c src/lib/libskey.orig/skeylogin.c src/lib/libskey/skeylogin.c
*** src/lib/libskey.orig/skeylogin.c	Tue May 30 05:33:39 1995
--- src/lib/libskey/skeylogin.c	Sat Jun  3 21:45:20 1995
***************
*** 20,39 ****
  #include <sys/timeb.h>
  #include <sys/resource.h>
  
-  
  #include <stdio.h>
  #include <string.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <time.h>
  #include <errno.h>
  #include "skey.h"
  
  #define	KEYFILE	"/etc/skeykeys"
  
! char *skipspace();
! int skeylookup __ARGS((struct skey *mp,char *name));
  
  
  /* Issue a skey challenge for user 'name'. If successful,
   * fill in the caller's skey structure and return 0. If unsuccessful
--- 20,43 ----
  #include <sys/timeb.h>
  #include <sys/resource.h>
  
  #include <stdio.h>
+ #include <stdlib.h>
  #include <string.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <time.h>
  #include <errno.h>
+ 
  #include "skey.h"
  
  #define	KEYFILE	"/etc/skeykeys"
  
! char *skipspace __ARGS((char *));
! int skeylookup __ARGS((struct skey *,  char *));
  
+ static int atob8 __ARGS((char *, char *));
+ static int btoa8 __ARGS((char *, char *));
+ static int htoi __ARGS((char));
  
  /* Issue a skey challenge for user 'name'. If successful,
   * fill in the caller's skey structure and return 0. If unsuccessful
***************
*** 107,113 ****
  {
  	int found;
  	int len;
! 	long recstart;
  	char *cp;
  	struct stat statbuf;
  
--- 111,117 ----
  {
  	int found;
  	int len;
! 	long recstart = 0L;
  	char *cp;
  	struct stat statbuf;
  
***************
*** 172,188 ****
  struct skey *mp;
  char *response;
  {
-  struct timeval startval;
-  struct timeval endval;
- long microsec;
  	char key[8];
  	char fkey[8];
  	char filekey[8];
  	time_t now;
  	struct tm *tm;
! 	char tbuf[27],buf[60];
! 	char me[80];
! 	int rval;
  	char *cp;
  
  	time(&now);
--- 176,187 ----
  struct skey *mp;
  char *response;
  {
  	char key[8];
  	char fkey[8];
  	char filekey[8];
  	time_t now;
  	struct tm *tm;
! 	char tbuf[27];
  	char *cp;
  
  	time(&now);
***************
*** 261,266 ****
--- 260,266 ----
  /* Convert 8-byte hex-ascii string to binary array
   * Returns 0 on success, -1 on error
   */
+ static int
  atob8(out,in)
  register char *out,*in;
  {
***************
*** 300,306 ****
  }
  
  /* Convert 8-byte binary array to hex-ascii string */
! int
  btoa8(out,in)
  register char *out,*in;
  {
--- 300,306 ----
  }
  
  /* Convert 8-byte binary array to hex-ascii string */
! static int
  btoa8(out,in)
  register char *out,*in;
  {
***************
*** 318,324 ****
  
  
  /* Convert hex digit to binary integer */
! int
  htoi(c)
  register char c;
  {
--- 318,324 ----
  
  
  /* Convert hex digit to binary integer */
! static int
  htoi(c)
  register char c;
  {
***************
*** 337,347 ****
   * Returns: 1 user doesnt exist, -1 fle error, 0 user exists.
   *
   */
!  
  skey_haskey (username)
!   char *username;
  {
-   int i;
    struct skey skey;
   
    return (skeylookup (&skey, username));
--- 337,346 ----
   * Returns: 1 user doesnt exist, -1 fle error, 0 user exists.
   *
   */
! int 
  skey_haskey (username)
! char *username;
  {
    struct skey skey;
   
    return (skeylookup (&skey, username));
***************
*** 354,361 ****
   * seed for the passed user.
   *
   */
! char *skey_keyinfo (username)
!   char *username;
  {
    int i;
    static char str [50];
--- 353,361 ----
   * seed for the passed user.
   *
   */
! char *
! skey_keyinfo (username)
! char *username;
  {
    int i;
    static char str [50];
***************
*** 378,386 ****
   * Returns: 0 success, -1 failure
   *
   */
!  
  skey_passcheck (username, passwd)
!   char *username, *passwd;
  {
    int i;
    struct skey skey;
--- 378,386 ----
   * Returns: 0 success, -1 failure
   *
   */
! int 
  skey_passcheck (username, passwd)
! char *username, *passwd;
  {
    int i;
    struct skey skey;
***************
*** 405,413 ****
   * Returns: 0 success, -1 failure
   *
   */
!  
  skey_authenticate (username)
!   char *username;
  {
    int i;
    char pbuf [256], skeyprompt [50];
--- 405,413 ----
   * Returns: 0 success, -1 failure
   *
   */
! int 
  skey_authenticate (username)
! char *username;
  {
    int i;
    char pbuf [256], skeyprompt [50];
diff -c src/lib/libskey.orig/skeysubr.c src/lib/libskey/skeysubr.c
*** src/lib/libskey.orig/skeysubr.c	Tue May 30 05:33:40 1995
--- src/lib/libskey/skeysubr.c	Sat Jun  3 21:39:59 1995
***************
*** 25,31 ****
  struct termios newtty;
  struct termios oldtty;
  
! void trapped();
  
  /* Crunch a key:
   * concatenate the seed and the password, run through MD4 and
--- 25,34 ----
  struct termios newtty;
  struct termios oldtty;
  
! static void trapped __ARGS((int sig));
! static void set_term __ARGS((void));
! static void unset_term __ARGS((void));
! static void echo_off __ARGS((void));
  
  /* Crunch a key:
   * concatenate the seed and the password, run through MD4 and
***************
*** 78,84 ****
  }
  
  /* The one-way function f(). Takes 8 bytes and returns 8 bytes in place */
! void f (x)
  char *x;
  {
  	MDstruct md;
--- 81,88 ----
  }
  
  /* The one-way function f(). Takes 8 bytes and returns 8 bytes in place */
! void
! f (x)
  char *x;
  {
  	MDstruct md;
***************
*** 114,120 ****
  }
  
  /* Strip trailing cr/lf from a line of text */
! void rip (buf)
  char *buf;
  {
  	char *cp;
--- 118,125 ----
  }
  
  /* Strip trailing cr/lf from a line of text */
! void
! rip (buf)
  char *buf;
  {
  	char *cp;
***************
*** 126,132 ****
  		*cp = '\0';
  }
  
! char *readpass (buf,n)
  char *buf;
  int n;
  {
--- 131,138 ----
  		*cp = '\0';
  }
  
! char *
! readpass (buf,n)
  char *buf;
  int n;
  {
***************
*** 144,150 ****
      return buf;
  }
  
! char *readskey (buf, n)
  char *buf;
  int n;
  {
--- 150,157 ----
      return buf;
  }
  
! char *
! readskey (buf, n)
  char *buf;
  int n;
  {
***************
*** 158,163 ****
--- 165,171 ----
      return buf;
  }
  
+ static void
  set_term () 
  {
      fflush(stdout);
***************
*** 167,172 ****
--- 175,181 ----
      signal (SIGINT, trapped);
  }
  
+ static void
  echo_off ()
  {
      newtty.c_lflag &= ~(ICANON | ECHO | ECHONL);
***************
*** 177,228 ****
      tcsetattr(fileno(stdin), TCSADRAIN, &newtty);
  }
  
  unset_term ()
  {
      tcsetattr(fileno(stdin), TCSADRAIN, &oldtty);
  }
  
! void trapped()
!  {
    signal (SIGINT, trapped);
    printf ("^C\n");
    unset_term ();
    exit (-1);
-  }
- 
- /* removebackspaced over charaters from the string */
- backspace(buf)
- char *buf;
- {
- 	char bs = 0x8;
- 	char *cp = buf;
- 	char *out = buf;
- 
- 	while(*cp){
- 		if( *cp == bs ) {
- 			if(out == buf){
- 				cp++;
- 				continue;
- 			}
- 			else {
- 			  cp++;
- 			  out--;
- 			}
- 		}
- 		else {
- 			*out++ = *cp++;
- 		}
- 
- 	}
- 	*out = '\0';
- 	
  }
  
  /* sevenbit ()
   *
   * Make sure line is all seven bits.
   */
!  
  sevenbit (s)
  char *s;
  {
--- 186,212 ----
      tcsetattr(fileno(stdin), TCSADRAIN, &newtty);
  }
  
+ static void
  unset_term ()
  {
      tcsetattr(fileno(stdin), TCSADRAIN, &oldtty);
  }
  
! static void
! trapped(sig)
! int sig;
! {
    signal (SIGINT, trapped);
    printf ("^C\n");
    unset_term ();
    exit (-1);
  }
  
  /* sevenbit ()
   *
   * Make sure line is all seven bits.
   */
! void 
  sevenbit (s)
  char *s;
  {
>Audit-Trail:
>Unformatted: