*** empty log message ***
authorTheodore Tso <tytso@mit.edu>
Thu, 3 Jun 1993 11:31:22 +0000 (11:31 +0000)
committerTheodore Tso <tytso@mit.edu>
Thu, 3 Jun 1993 11:31:22 +0000 (11:31 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2571 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/sample/fcmd.c
src/lib/gssapi/sample/flogin.c
src/lib/gssapi/sample/flogind.c
src/lib/gssapi/sample/login.c

index a3de08fb1798a084ddcc533e55cf94e41ecf2b31..351e5024ab6b86f42b751e82356180319df7ae8e 100644 (file)
@@ -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;
        }
 
index 1bb041ccdf738dd7a3991b26cc184d1768f1d8b1..0fc70195ef7f25b9037f8d961e2f981821ea2f40 100644 (file)
@@ -62,7 +62,6 @@ static char sccsid[] = "@(#)rlogin.c  5.29 (Berkeley) 6/27/90";
 #include <sgtty.h>
 #include <setjmp.h>
 #include <errno.h>
-#include <varargs.h>
 #include <pwd.h>
 #include <stdio.h>
 #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;
index 97ae7040e5a10f9598297998899cfbb599cb91e2..956a068481727e2706514f3c65e38b10cde609c1 100644 (file)
@@ -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;
index b984b2b6398e5cbd5439f5121ab696141e7aa0e7..03aaf4520dfd5338e7e8b8de4be21a05bfec9167 100644 (file)
@@ -41,7 +41,7 @@ static char sccsid[] = "@(#)login.c   5.25 (Berkeley) 1/6/89";
 #include <sys/param.h>
 #ifndef VFS
 #include <sys/quota.h>
-#endif VFS
+#endif /* VFS */
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/resource.h>
@@ -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);