* sserver.c: Use new calling convention for krb5_recvauth()
authorChris Provenzano <proven@mit.edu>
Mon, 27 Mar 1995 14:22:04 +0000 (14:22 +0000)
committerChris Provenzano <proven@mit.edu>
Mon, 27 Mar 1995 14:22:04 +0000 (14:22 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5254 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/sample/sserver/ChangeLog
src/appl/sample/sserver/sserver.c

index a0640009b27016925f4038f08d1852c5e86a1da9..4ca569d22c79728289c281f59c4d1a3afccbd9c5 100644 (file)
@@ -1,3 +1,7 @@
+Mon Mar 27 07:56:26 1995 Chris Provenzano (proven@mit.edu)
+
+        * sserver.c: Use new calling convention for krb5_recvauth().
+
 Thu Mar  2 12:27:36 1995  Theodore Y. Ts'o  <tytso@dcl>
 
        * Makefile.in (ISODELIB): Remove reference to $(ISODELIB).
index 4c69a1d6d7bfbc5fe2a813971364700d6628f7a2..dd7fb64dd903f9fcae75b12c82629d360690aeb0 100644 (file)
@@ -53,14 +53,16 @@ extern krb5_deltat krb5_clockskew;
 
 void
 main(argc, argv)
-int argc;
-char *argv[];
+    int argc;
+    char *argv[];
 {
     krb5_context context;
-    struct sockaddr_in peername;
+    krb5_auth_context * auth_context;
+    krb5_ticket * ticket;
     krb5_address peeraddr;
+    struct sockaddr_in peername;
     int namelen = sizeof(peername);
-    int sock = 0;                      /* incoming connection fd */
+    int sock = -1;                     /* incoming connection fd */
     krb5_data recv_data;
     short xmitlen;
     krb5_error_code retval;
@@ -105,7 +107,7 @@ char *argv[];
            syslog(LOG_ERR, "listen: %m");
            exit(3);
        }
-       if ((acc = accept(sock, (struct sockaddr *)&peername, &namelen)) == -1) {
+       if ((acc = accept(sock, (struct sockaddr *)&peername, &namelen)) == -1){
            syslog(LOG_ERR, "accept: %m");
            exit(3);
        }
@@ -127,28 +129,24 @@ char *argv[];
     peeraddr.length = sizeof(peername.sin_addr);
     peeraddr.contents = (krb5_octet *)&peername.sin_addr;
 
-    if (retval = krb5_recvauth(context, (krb5_pointer)&sock,
-                              SAMPLE_VERSION, server, &peeraddr,
-                              0, 0, 0, /* no fetchfrom, keyproc or arg */
-                              0,       /* default rc type */
+    if (retval = krb5_recvauth(context, &auth_context, (krb5_pointer)&sock,
+                              SAMPLE_VERSION, server, 
+                              NULL,    /* default rc type */
                               0,       /* no flags */
-                              0,       /* don't need seq number */
-                              &client,
-                              0, 0     /* don't care about ticket or
-                                          authenticator */
-                              )) {
+                              NULL,    /* default keytab */
+                              &ticket)) {
        syslog(LOG_ERR, "recvauth failed--%s", error_message(retval));
        exit(1);
     }
 
-    if (retval = krb5_unparse_name(context, client, &cname)) {
+    /* Get client name */
+    if (retval = krb5_unparse_name(context, ticket->enc_part2->client, &cname)){
        syslog(LOG_ERR, "unparse failed: %s", error_message(retval));
-       cname = "<unparse error>";
-    }
-
-    sprintf(repbuf, "You are %s\n", cname);
-    if (!retval)
+        sprintf(repbuf, "You are <unparse error>\n", cname);
+    } else {
+        sprintf(repbuf, "You are %s\n", cname);
        free(cname);
+    }
     xmitlen = htons(strlen(repbuf));
     recv_data.length = strlen(repbuf);
     recv_data.data = repbuf;