From 9c1bfa49c7598f28ce7bee6f870e453f24d51994 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Thu, 3 Jun 1993 11:31:22 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2571 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/gssapi/sample/fcmd.c | 40 +++++++++------------ src/lib/gssapi/sample/flogin.c | 3 -- src/lib/gssapi/sample/flogind.c | 8 ++--- src/lib/gssapi/sample/login.c | 61 +++++++++++++++------------------ 4 files changed, 49 insertions(+), 63 deletions(-) diff --git a/src/lib/gssapi/sample/fcmd.c b/src/lib/gssapi/sample/fcmd.c index a3de08fb1..351e5024a 100644 --- a/src/lib/gssapi/sample/fcmd.c +++ b/src/lib/gssapi/sample/fcmd.c @@ -79,16 +79,13 @@ context_handle, mutual_flag, deleg_flag, debugflag) unsigned char *charp; char tokenheader[4], recv_tokenheader[4]; int tokenlen, i, j, status = 0, hostlen, xcc, cc, mutual_len; - int chanbinding_len, replay_flag=0, seq_flag=0; - char hostname[GSS_C_MAX_PRINTABLE_NAME]; + int replay_flag=0, seq_flag=0; char mutual_resp[GSS_C_MAX_TOKEN]; char targ_printable[GSS_C_MAX_PRINTABLE_NAME]; /* * GSS API support */ - gss_OID_set actual_mechs; gss_OID actual_mech_type, output_name_type; - gss_cred_id_t gss_cred_handle; gss_ctx_id_t actual_ctxhandle; int msg_ctx = 0, new_status; int req_flags = 0, ret_flags, lifetime_rec, major_status; @@ -119,7 +116,7 @@ context_handle, mutual_flag, deleg_flag, debugflag) sin.sin_family = hp->h_addrtype; bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length); sin.sin_port = rport; - if (connect(s, (caddr_t)&sin, sizeof (sin), 0) >= 0) + if (connect(s, (caddr_t)&sin, sizeof (sin)) >= 0) break; (void) close(s); if (errno == EADDRINUSE) { @@ -182,7 +179,7 @@ context_handle, mutual_flag, deleg_flag, debugflag) (void) close(s2); goto bad; } - s3 = accept(s2, &from, &len, 0); + s3 = accept(s2, &from, &len); (void) close(s2); if (s3 < 0) { perror("accept"); @@ -208,6 +205,7 @@ context_handle, mutual_flag, deleg_flag, debugflag) */ { char myhost[32]; + char *address; int from_addr=0, to_addr=0, myhostlen, j; struct hostent *my_hp; @@ -254,28 +252,24 @@ context_handle, mutual_flag, deleg_flag, debugflag) to_addr = htonl(to_addr); input_chan_bindings = (gss_channel_bindings) - malloc(sizeof(gss_channel_bindings_desc)); + malloc(sizeof(struct gss_channel_bindings_desc)); input_chan_bindings->initiator_addrtype = GSS_C_AF_INET; input_chan_bindings->initiator_address.length = 4; - input_chan_bindings->initiator_address.value = (char *) malloc(4); - input_chan_bindings->initiator_address.value[0] = ((from_addr -& 0xff000000) >> 24); - input_chan_bindings->initiator_address.value[1] = ((from_addr -& 0xff0000) >> 16); - input_chan_bindings->initiator_address.value[2] = ((from_addr -& 0xff00) >> 8); - input_chan_bindings->initiator_address.value[3] = (from_addr & 0xff); + address = (char *) malloc(4); + input_chan_bindings->initiator_address.value = (char *) address; + address[0] = ((from_addr & 0xff000000) >> 24); + address[1] = ((from_addr & 0xff0000) >> 16); + address[2] = ((from_addr & 0xff00) >> 8); + address[3] = (from_addr & 0xff); input_chan_bindings->acceptor_addrtype = GSS_C_AF_INET; input_chan_bindings->acceptor_address.length = 4; - input_chan_bindings->acceptor_address.value = (char *) malloc(4); - input_chan_bindings->acceptor_address.value[0] = ((to_addr & -0xff000000) >> 24); - input_chan_bindings->acceptor_address.value[1] = ((to_addr & -0xff0000) >> 16); - input_chan_bindings->acceptor_address.value[2] = ((to_addr & -0xff00) >> 8); - input_chan_bindings->acceptor_address.value[3] = (to_addr & 0xff); + address = (char *) malloc(4); + input_chan_bindings->acceptor_address.value = (char *) address; + address[0] = ((to_addr & 0xff000000) >> 24); + address[1] = ((to_addr & 0xff0000) >> 16); + address[2] = ((to_addr & 0xff00) >> 8); + address[3] = (to_addr & 0xff); input_chan_bindings->application_data.length = 0; } diff --git a/src/lib/gssapi/sample/flogin.c b/src/lib/gssapi/sample/flogin.c index 1bb041ccd..0fc70195e 100644 --- a/src/lib/gssapi/sample/flogin.c +++ b/src/lib/gssapi/sample/flogin.c @@ -62,7 +62,6 @@ static char sccsid[] = "@(#)rlogin.c 5.29 (Berkeley) 6/27/90"; #include #include #include -#include #include #include #ifdef ultrix @@ -107,8 +106,6 @@ struct winsize winsize; #define get_window_size(fd, wp) ioctl(fd, TIOCGWINSZ, wp) #endif -void exit(); - main(argc, argv) int argc; char **argv; diff --git a/src/lib/gssapi/sample/flogind.c b/src/lib/gssapi/sample/flogind.c index 97ae7040e..956a06848 100644 --- a/src/lib/gssapi/sample/flogind.c +++ b/src/lib/gssapi/sample/flogind.c @@ -277,8 +277,8 @@ protocol(f, p, pipe) pcc = write(pipe, fibuf, cc); if (pcc <= 0) { done = 1; - syslog(LOG_INFO, "write(pipe [%d], fibuf, %d): %d: -%m",pipe, cc, pcc); + syslog(LOG_INFO, "write(pipe [%d], fibuf, %d): %d: %m", + pipe, cc, pcc); } while (!done && len > 0) { char *fbp = fibuf; @@ -293,8 +293,8 @@ protocol(f, p, pipe) pcc = write(pipe, fbp, cc); if (pcc <= 0) { done = 1; - syslog(LOG_INFO, "write(pipe [%d], fbp, %d): -%d: %m",pipe, cc, pcc); + syslog(LOG_INFO, "write(pipe [%d], fbp, %d): %d: %m", + pipe, cc, pcc); break; } cc -= pcc; diff --git a/src/lib/gssapi/sample/login.c b/src/lib/gssapi/sample/login.c index b984b2b63..03aaf4520 100644 --- a/src/lib/gssapi/sample/login.c +++ b/src/lib/gssapi/sample/login.c @@ -41,7 +41,7 @@ static char sccsid[] = "@(#)login.c 5.25 (Berkeley) 1/6/89"; #include #ifndef VFS #include -#endif VFS +#endif /* VFS */ #include #include #include @@ -75,11 +75,11 @@ char userlocalname[GSS_C_MAX_PRINTABLE_NAME]; gss_cred_id_t gss_delegated_cred_handle; #ifdef UIDGID_T -uid_t getuid(); +/* uid_t getuid(); */ #define uid_type uid_t #define gid_type gid_t #else -int getuid(); +/* int getuid(); */ #define uid_type int #define gid_type int #endif /* UIDGID_T */ @@ -95,7 +95,7 @@ int getuid(); #ifdef VFS #define QUOTAWARN "/usr/ucb/quota" /* warn user about quotas */ -#endif VFS +#endif /* VFS */ #define UT_HOSTSIZE sizeof(((struct utmp *)0)->ut_host) #define UT_NAMESIZE sizeof(((struct utmp *)0)->ut_name) @@ -130,8 +130,7 @@ typedef int sigtype; #define EXCL_TEST if (rflag || kflag || Kflag || eflag || \ fflag || hflag) { \ fprintf(stderr, \ - "login: only one of -r, -k, -K, -e, --h and -f allowed.\n"); \ + "login: only one of -r, -k, -K, -e, -h and -f allowed.\n"); \ exit(1);\ } main(argc, argv) @@ -163,7 +162,7 @@ main(argc, argv) (void)setpriority(PRIO_PROCESS, 0, 0); #ifndef VFS (void)quota(Q_SETUID, 0, 0, 0); -#endif VFS +#endif /* VFS */ /* * -s is used by flogind to cause the SPX autologin protocol; @@ -462,7 +461,7 @@ main(argc, argv) #ifdef VFS if (! access( QUOTAWARN, X_OK)) (void) system(QUOTAWARN); -#endif VFS +#endif /* VFS */ (void)signal(SIGALRM, SIG_DFL); (void)signal(SIGQUIT, SIG_DFL); (void)signal(SIGINT, SIG_DFL); @@ -522,7 +521,7 @@ rootterm(tty) struct ttyent *t; return((t = getttynam(tty)) && t->ty_status&TTY_SECURE); -#endif NOTTYENT +#endif /* NOTTYENT */ } jmp_buf motdinterrupt; @@ -631,7 +630,7 @@ do_gss_login(host) char *host; { int j, tokenlen, partlen, numbuf, i, debugflag = 0, auth_valid; - unsigned char token[GSS_C_MAX_TOKEN], *charp, *cp; + unsigned char token[GSS_C_MAX_TOKEN], *charp, *cp, *address; unsigned char tokenheader[4], send_tokenheader[4]; char targ_printable[GSS_C_MAX_PRINTABLE_NAME]; char lhostname[GSS_C_MAX_PRINTABLE_NAME]; @@ -655,15 +654,14 @@ do_gss_login(host) j = sphinx_net_read(3, tokenheader, 4); - if ((tokenheader[0] != TOKEN_MAJIC_NUMBER_BYTE0) || -(tokenheader[1] != TOKEN_MAJIC_NUMBER_BYTE1)) { + if ((tokenheader[0] != TOKEN_MAJIC_NUMBER_BYTE0) || (tokenheader[1] != TOKEN_MAJIC_NUMBER_BYTE1)) { exit(0); } tokenlen = tokenheader[2] * 256 + tokenheader[3]; if (tokenlen > sizeof(token)) { - syslog(LOG_INFO, "token is too large, size is %d, buffer size -is %d", tokenlen, sizeof(token)); + syslog(LOG_INFO, "token is too large, size is %d, buffer size is %d", + tokenlen, sizeof(token)); exit(0); } @@ -783,28 +781,24 @@ is %d", tokenlen, sizeof(token)); } input_chan_bindings = (gss_channel_bindings) - malloc(sizeof(gss_channel_bindings_desc)); + malloc(sizeof(struct gss_channel_bindings_desc)); input_chan_bindings->initiator_addrtype = GSS_C_AF_INET; input_chan_bindings->initiator_address.length = 4; - input_chan_bindings->initiator_address.value = (char *) malloc(4); - input_chan_bindings->initiator_address.value[0] = ((from_addr -& 0xff000000) >> 24); - input_chan_bindings->initiator_address.value[1] = ((from_addr -& 0xff0000) >> 16); - input_chan_bindings->initiator_address.value[2] = ((from_addr -& 0xff00) >> 8); - input_chan_bindings->initiator_address.value[3] = (from_addr & 0xff); + address = (char *) malloc(4); + input_chan_bindings->initiator_address.value = (char *) address; + address[0] = ((from_addr & 0xff000000) >> 24); + address[1] = ((from_addr & 0xff0000) >> 16); + address[2] = ((from_addr & 0xff00) >> 8); + address[3] = (from_addr & 0xff); input_chan_bindings->acceptor_addrtype = GSS_C_AF_INET; input_chan_bindings->acceptor_address.length = 4; - input_chan_bindings->acceptor_address.value = (char *) malloc(4); - input_chan_bindings->acceptor_address.value[0] = ((to_addr & -0xff000000) >> 24); - input_chan_bindings->acceptor_address.value[1] = ((to_addr & -0xff0000) >> 16); - input_chan_bindings->acceptor_address.value[2] = ((to_addr & -0xff00) >> 8); - input_chan_bindings->acceptor_address.value[3] = (to_addr & 0xff); + address = (char *) malloc(4); + input_chan_bindings->acceptor_address.value = (char *) address; + address[0] = ((to_addr & 0xff000000) >> 24); + address[1] = ((to_addr & 0xff0000) >> 16); + address[2] = ((to_addr & 0xff00) >> 8); + address[3] = (to_addr & 0xff); input_chan_bindings->application_data.length = 0; } @@ -944,8 +938,9 @@ is %d", tokenlen, sizeof(token)); if (major_status != GSS_S_COMPLETE) { if (strcmp(lusername, "root")==0) syslog(LOG_INFO, "root authorization denied - '%s'", src_name); - fprintf(stderr, "SPX : authorization denied to user account -'%s' - ", lusername); + fprintf(stderr, + "SPX : authorization denied to user account '%s' - ", + lusername); return(-1); } else { strcpy(userfullname, src_name); -- 2.26.2