diff options
author | Greg Hudson <ghudson@mit.edu> | 2009-11-24 17:46:45 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2009-11-24 17:46:45 +0000 |
commit | 6b684da8b8aa0aa5e7a0f122e5d6b303c6fddf00 (patch) | |
tree | db6e8ce701a0e0a905e45c82f1c65f64a733e23c /src/appl/user_user | |
parent | 3aa283767b10ac11b035b690f4569ce5de5e0097 (diff) | |
download | krb5-6b684da8b8aa0aa5e7a0f122e5d6b303c6fddf00.tar.gz krb5-6b684da8b8aa0aa5e7a0f122e5d6b303c6fddf00.tar.xz krb5-6b684da8b8aa0aa5e7a0f122e5d6b303c6fddf00.zip |
Mark and reindent what's left of the appl directory
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23342 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl/user_user')
-rw-r--r-- | src/appl/user_user/client.c | 447 | ||||
-rw-r--r-- | src/appl/user_user/server.c | 318 |
2 files changed, 386 insertions, 379 deletions
diff --git a/src/appl/user_user/client.c b/src/appl/user_user/client.c index a2f8e7f72a..39bd188e2f 100644 --- a/src/appl/user_user/client.c +++ b/src/appl/user_user/client.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * appl/user_user/client.c * @@ -39,239 +40,243 @@ #include "k5-int.h" #include "com_err.h" -int main (argc, argv) -int argc; -char *argv[]; +int main (int argc, char *argv[]) { - int s; - register int retval, i; - char *hname; /* full name of server */ - char **srealms; /* realm(s) of server */ - char *princ; /* principal in credentials cache */ - struct servent *serv; - struct hostent *host; - struct sockaddr_in serv_net_addr, cli_net_addr; - krb5_ccache cc; - krb5_creds creds, *new_creds; - krb5_data reply, msg, princ_data; - krb5_auth_context auth_context = NULL; - krb5_ticket * ticket = NULL; - krb5_context context; - unsigned short port; - - if (argc < 2 || argc > 4) { - fputs ("usage: uu-client <hostname> [message [port]]\n", stderr); - return 1; - } - - retval = krb5_init_context(&context); - if (retval) { - com_err(argv[0], retval, "while initializing krb5"); - exit(1); - } - - if (argc == 4) { - port = htons(atoi(argv[3])); - } - else if ((serv = getservbyname ("uu-sample", "tcp")) == NULL) - { - fputs ("uu-client: unknown service \"uu-sample/tcp\"\n", stderr); - return 2; - } else { - port = serv->s_port; - } - - if ((host = gethostbyname (argv[1])) == NULL) { - fprintf (stderr, "uu-client: can't get address of host \"%s\".\n", - argv[1]); - return 3; - } - - if (host->h_addrtype != AF_INET) { - fprintf (stderr, "uu-client: bad address type %d for \"%s\".\n", - host->h_addrtype, argv[1]); - return 3; - } - - hname = strdup (host->h_name); + int s; + register int retval, i; + char *hname; /* full name of server */ + char **srealms; /* realm(s) of server */ + char *princ; /* principal in credentials cache */ + struct servent *serv; + struct hostent *host; + struct sockaddr_in serv_net_addr, cli_net_addr; + krb5_ccache cc; + krb5_creds creds, *new_creds; + krb5_data reply, msg, princ_data; + krb5_auth_context auth_context = NULL; + krb5_ticket * ticket = NULL; + krb5_context context; + unsigned short port; + + if (argc < 2 || argc > 4) { + fputs ("usage: uu-client <hostname> [message [port]]\n", stderr); + return 1; + } + + retval = krb5_init_context(&context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } + + if (argc == 4) { + port = htons(atoi(argv[3])); + } + else if ((serv = getservbyname ("uu-sample", "tcp")) == NULL) + { + fputs ("uu-client: unknown service \"uu-sample/tcp\"\n", stderr); + return 2; + } else { + port = serv->s_port; + } + + if ((host = gethostbyname (argv[1])) == NULL) { + fprintf (stderr, "uu-client: can't get address of host \"%s\".\n", + argv[1]); + return 3; + } + + if (host->h_addrtype != AF_INET) { + fprintf (stderr, "uu-client: bad address type %d for \"%s\".\n", + host->h_addrtype, argv[1]); + return 3; + } + + hname = strdup (host->h_name); #ifndef USE_STDOUT - if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - com_err ("uu-client", errno, "creating socket"); - return 4; - } else { - cli_net_addr.sin_family = AF_INET; - cli_net_addr.sin_port = 0; - cli_net_addr.sin_addr.s_addr = 0; - if (bind (s, (struct sockaddr *)&cli_net_addr, - sizeof (cli_net_addr)) < 0) { - com_err ("uu-client", errno, "binding socket"); - return 4; - } - } - - serv_net_addr.sin_family = AF_INET; - serv_net_addr.sin_port = port; - - i = 0; - while (1) { - if (host->h_addr_list[i] == 0) { - fprintf (stderr, "uu-client: unable to connect to \"%s\"\n", hname); - return 5; - } - - memcpy (&serv_net_addr.sin_addr, host->h_addr_list[i++], - sizeof(serv_net_addr.sin_addr)); - - if (connect(s, (struct sockaddr *)&serv_net_addr, - sizeof (serv_net_addr)) == 0) - break; - com_err ("uu-client", errno, "connecting to \"%s\" (%s).", - hname, inet_ntoa(serv_net_addr.sin_addr)); - } + if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + com_err ("uu-client", errno, "creating socket"); + return 4; + } else { + cli_net_addr.sin_family = AF_INET; + cli_net_addr.sin_port = 0; + cli_net_addr.sin_addr.s_addr = 0; + if (bind (s, (struct sockaddr *)&cli_net_addr, + sizeof (cli_net_addr)) < 0) { + com_err ("uu-client", errno, "binding socket"); + return 4; + } + } + + serv_net_addr.sin_family = AF_INET; + serv_net_addr.sin_port = port; + + i = 0; + while (1) { + if (host->h_addr_list[i] == 0) { + fprintf (stderr, "uu-client: unable to connect to \"%s\"\n", hname); + return 5; + } + + memcpy (&serv_net_addr.sin_addr, host->h_addr_list[i++], + sizeof(serv_net_addr.sin_addr)); + + if (connect(s, (struct sockaddr *)&serv_net_addr, + sizeof (serv_net_addr)) == 0) + break; + com_err ("uu-client", errno, "connecting to \"%s\" (%s).", + hname, inet_ntoa(serv_net_addr.sin_addr)); + } #else - s = 1; + s = 1; #endif - retval = krb5_cc_default(context, &cc); - if (retval) { - com_err("uu-client", retval, "getting credentials cache"); - return 6; - } - - memset (&creds, 0, sizeof(creds)); - - retval = krb5_cc_get_principal(context, cc, &creds.client); - if (retval) { - com_err("uu-client", retval, "getting principal name"); - return 6; - } - - retval = krb5_unparse_name(context, creds.client, &princ); - if (retval) { - com_err("uu-client", retval, "printing principal name"); - return 7; - } - else - fprintf(stderr, "uu-client: client principal is \"%s\".\n", princ); - - retval = krb5_get_host_realm(context, hname, &srealms); - if (retval) { - com_err("uu-client", retval, "getting realms for \"%s\"", hname); - return 7; - } - - retval = - krb5_build_principal_ext(context, &creds.server, - krb5_princ_realm(context, creds.client)->length, - krb5_princ_realm(context, creds.client)->data, - 6, "krbtgt", - krb5_princ_realm(context, creds.client)->length, - krb5_princ_realm(context, creds.client)->data, - 0); - if (retval) { - com_err("uu-client", retval, "setting up tgt server name"); - return 7; - } - - /* Get TGT from credentials cache */ - retval = krb5_get_credentials(context, KRB5_GC_CACHED, cc, - &creds, &new_creds); - if (retval) { - com_err("uu-client", retval, "getting TGT"); - return 6; - } - - i = strlen(princ) + 1; - - fprintf(stderr, "uu-client: sending %d bytes\n",new_creds->ticket.length + i); - princ_data.data = princ; - princ_data.length = i; /* include null terminator for - server's convenience */ - retval = krb5_write_message(context, (krb5_pointer) &s, &princ_data); - if (retval) { - com_err("uu-client", retval, "sending principal name to server"); - return 8; - } - - free(princ); - - retval = krb5_write_message(context, (krb5_pointer) &s, &new_creds->ticket); - if (retval) { - com_err("uu-client", retval, "sending ticket to server"); - return 8; - } - - retval = krb5_read_message(context, (krb5_pointer) &s, &reply); - if (retval) { - com_err("uu-client", retval, "reading reply from server"); - return 9; - } - - retval = krb5_auth_con_init(context, &auth_context); - if (retval) { - com_err("uu-client", retval, "initializing the auth_context"); - return 9; - } - - retval = - krb5_auth_con_genaddrs(context, auth_context, s, - KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR | - KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR); - if (retval) { - com_err("uu-client", retval, "generating addrs for auth_context"); - return 9; + retval = krb5_cc_default(context, &cc); + if (retval) { + com_err("uu-client", retval, "getting credentials cache"); + return 6; + } + + memset (&creds, 0, sizeof(creds)); + + retval = krb5_cc_get_principal(context, cc, &creds.client); + if (retval) { + com_err("uu-client", retval, "getting principal name"); + return 6; + } + + retval = krb5_unparse_name(context, creds.client, &princ); + if (retval) { + com_err("uu-client", retval, "printing principal name"); + return 7; } + else + fprintf(stderr, "uu-client: client principal is \"%s\".\n", princ); - retval = krb5_auth_con_setflags(context, auth_context, - KRB5_AUTH_CONTEXT_DO_SEQUENCE); - if (retval) { - com_err("uu-client", retval, "initializing the auth_context flags"); - return 9; - } + retval = krb5_get_host_realm(context, hname, &srealms); + if (retval) { + com_err("uu-client", retval, "getting realms for \"%s\"", hname); + return 7; + } - retval = krb5_auth_con_setuseruserkey(context, auth_context, - &new_creds->keyblock); - if (retval) { - com_err("uu-client", retval, "setting useruserkey for authcontext"); - return 9; - } + retval = + krb5_build_principal_ext(context, &creds.server, + krb5_princ_realm(context, + creds.client)->length, + krb5_princ_realm(context, + creds.client)->data, + 6, "krbtgt", + krb5_princ_realm(context, + creds.client)->length, + krb5_princ_realm(context, + creds.client)->data, + 0); + if (retval) { + com_err("uu-client", retval, "setting up tgt server name"); + return 7; + } + + /* Get TGT from credentials cache */ + retval = krb5_get_credentials(context, KRB5_GC_CACHED, cc, + &creds, &new_creds); + if (retval) { + com_err("uu-client", retval, "getting TGT"); + return 6; + } + + i = strlen(princ) + 1; + + fprintf(stderr, "uu-client: sending %d bytes\n", + new_creds->ticket.length + i); + princ_data.data = princ; + princ_data.length = i; /* include null terminator for + server's convenience */ + retval = krb5_write_message(context, (krb5_pointer) &s, &princ_data); + if (retval) { + com_err("uu-client", retval, "sending principal name to server"); + return 8; + } + + free(princ); + + retval = krb5_write_message(context, (krb5_pointer) &s, + &new_creds->ticket); + if (retval) { + com_err("uu-client", retval, "sending ticket to server"); + return 8; + } + + retval = krb5_read_message(context, (krb5_pointer) &s, &reply); + if (retval) { + com_err("uu-client", retval, "reading reply from server"); + return 9; + } + + retval = krb5_auth_con_init(context, &auth_context); + if (retval) { + com_err("uu-client", retval, "initializing the auth_context"); + return 9; + } + + retval = + krb5_auth_con_genaddrs(context, auth_context, s, + KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR | + KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR); + if (retval) { + com_err("uu-client", retval, "generating addrs for auth_context"); + return 9; + } + + retval = krb5_auth_con_setflags(context, auth_context, + KRB5_AUTH_CONTEXT_DO_SEQUENCE); + if (retval) { + com_err("uu-client", retval, "initializing the auth_context flags"); + return 9; + } + + retval = krb5_auth_con_setuseruserkey(context, auth_context, + &new_creds->keyblock); + if (retval) { + com_err("uu-client", retval, "setting useruserkey for authcontext"); + return 9; + } #if 1 - /* read the ap_req to get the session key */ - retval = krb5_rd_req(context, &auth_context, &reply, - NULL, NULL, NULL, &ticket); - free(reply.data); + /* read the ap_req to get the session key */ + retval = krb5_rd_req(context, &auth_context, &reply, + NULL, NULL, NULL, &ticket); + free(reply.data); #else - retval = krb5_recvauth(context, &auth_context, (krb5_pointer)&s, "???", - 0, /* server */, 0, NULL, &ticket); + retval = krb5_recvauth(context, &auth_context, (krb5_pointer)&s, "???", + 0, /* server */, 0, NULL, &ticket); #endif - if (retval) { - com_err("uu-client", retval, "reading AP_REQ from server"); - return 9; - } - - retval = krb5_unparse_name(context, ticket->enc_part2->client, &princ); - if (retval) - com_err("uu-client", retval, "while unparsing client name"); - else { - printf("server is named \"%s\"\n", princ); - free(princ); - } - - retval = krb5_read_message(context, (krb5_pointer) &s, &reply); - if (retval) { - com_err("uu-client", retval, "reading reply from server"); - return 9; - } - - retval = krb5_rd_safe(context, auth_context, &reply, &msg, NULL); - if (retval) { - com_err("uu-client", retval, "decoding reply from server"); - return 10; - } - - printf ("uu-client: server says \"%s\".\n", msg.data); - return 0; + if (retval) { + com_err("uu-client", retval, "reading AP_REQ from server"); + return 9; + } + + retval = krb5_unparse_name(context, ticket->enc_part2->client, &princ); + if (retval) + com_err("uu-client", retval, "while unparsing client name"); + else { + printf("server is named \"%s\"\n", princ); + free(princ); + } + + retval = krb5_read_message(context, (krb5_pointer) &s, &reply); + if (retval) { + com_err("uu-client", retval, "reading reply from server"); + return 9; + } + + retval = krb5_rd_safe(context, auth_context, &reply, &msg, NULL); + if (retval) { + com_err("uu-client", retval, "decoding reply from server"); + return 10; + } + + printf ("uu-client: server says \"%s\".\n", msg.data); + return 0; } diff --git a/src/appl/user_user/server.c b/src/appl/user_user/server.c index 8a66bbdc0b..25c7b10a33 100644 --- a/src/appl/user_user/server.c +++ b/src/appl/user_user/server.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * appl/user_user/server.c * @@ -45,187 +46,188 @@ /* fd 0 is a tcp socket used to talk to the client */ int main(argc, argv) -int argc; -char *argv[]; + int argc; + char *argv[]; { - krb5_data pname_data, tkt_data; - int sock = 0; - socklen_t l; - int retval; - struct sockaddr_in l_inaddr, f_inaddr; /* local, foreign address */ - krb5_creds creds, *new_creds; - krb5_ccache cc; - krb5_data msgtext, msg; - krb5_context context; + krb5_data pname_data, tkt_data; + int sock = 0; + socklen_t l; + int retval; + struct sockaddr_in l_inaddr, f_inaddr; /* local, foreign address */ + krb5_creds creds, *new_creds; + krb5_ccache cc; + krb5_data msgtext, msg; + krb5_context context; krb5_auth_context auth_context = NULL; #ifndef DEBUG - freopen("/tmp/uu-server.log", "w", stderr); + freopen("/tmp/uu-server.log", "w", stderr); #endif - retval = krb5_init_context(&context); - if (retval) { - com_err(argv[0], retval, "while initializing krb5"); - exit(1); - } + retval = krb5_init_context(&context); + if (retval) { + com_err(argv[0], retval, "while initializing krb5"); + exit(1); + } #ifdef DEBUG - { - int one = 1; - int acc; - struct servent *sp; - socklen_t namelen = sizeof(f_inaddr); - - if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) { - com_err("uu-server", errno, "creating socket"); - exit(3); - } - - l_inaddr.sin_family = AF_INET; - l_inaddr.sin_addr.s_addr = 0; - if (!(sp = getservbyname("uu-sample", "tcp"))) { - com_err("uu-server", 0, "can't find uu-sample/tcp service"); - exit(3); - } - (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof (one)); - l_inaddr.sin_port = sp->s_port; - if (bind(sock, (struct sockaddr *)&l_inaddr, sizeof(l_inaddr))) { - com_err("uu-server", errno, "binding socket"); - exit(3); - } - if (listen(sock, 1) == -1) { - com_err("uu-server", errno, "listening"); - exit(3); - } - if ((acc = accept(sock, (struct sockaddr *)&f_inaddr, &namelen)) == -1) { - com_err("uu-server", errno, "accepting"); - exit(3); - } - dup2(acc, 0); - close(sock); - sock = 0; - } + { + int one = 1; + int acc; + struct servent *sp; + socklen_t namelen = sizeof(f_inaddr); + + if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) { + com_err("uu-server", errno, "creating socket"); + exit(3); + } + + l_inaddr.sin_family = AF_INET; + l_inaddr.sin_addr.s_addr = 0; + if (!(sp = getservbyname("uu-sample", "tcp"))) { + com_err("uu-server", 0, "can't find uu-sample/tcp service"); + exit(3); + } + (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof (one)); + l_inaddr.sin_port = sp->s_port; + if (bind(sock, (struct sockaddr *)&l_inaddr, sizeof(l_inaddr))) { + com_err("uu-server", errno, "binding socket"); + exit(3); + } + if (listen(sock, 1) == -1) { + com_err("uu-server", errno, "listening"); + exit(3); + } + if ((acc = accept(sock, (struct sockaddr *)&f_inaddr, &namelen)) == -1) { + com_err("uu-server", errno, "accepting"); + exit(3); + } + dup2(acc, 0); + close(sock); + sock = 0; + } #endif - retval = krb5_read_message(context, (krb5_pointer) &sock, &pname_data); - if (retval) { - com_err ("uu-server", retval, "reading pname"); - return 2; - } - - retval = krb5_read_message(context, (krb5_pointer) &sock, &tkt_data); - if (retval) { - com_err ("uu-server", retval, "reading ticket data"); - return 2; - } - - retval = krb5_cc_default(context, &cc); - if (retval) { - com_err("uu-server", retval, "getting credentials cache"); - return 4; - } - - memset (&creds, 0, sizeof(creds)); - retval = krb5_cc_get_principal(context, cc, &creds.client); - if (retval) { - com_err("uu-client", retval, "getting principal name"); - return 6; - } - - /* client sends it already null-terminated. */ - printf ("uu-server: client principal is \"%s\".\n", pname_data.data); - - retval = krb5_parse_name(context, pname_data.data, &creds.server); - if (retval) { - com_err("uu-server", retval, "parsing client name"); - return 3; - } - - creds.second_ticket = tkt_data; - printf ("uu-server: client ticket is %d bytes.\n", - creds.second_ticket.length); - - retval = krb5_get_credentials(context, KRB5_GC_USER_USER, cc, - &creds, &new_creds); - if (retval) { - com_err("uu-server", retval, "getting user-user ticket"); - return 5; - } + retval = krb5_read_message(context, (krb5_pointer) &sock, &pname_data); + if (retval) { + com_err ("uu-server", retval, "reading pname"); + return 2; + } + + retval = krb5_read_message(context, (krb5_pointer) &sock, &tkt_data); + if (retval) { + com_err ("uu-server", retval, "reading ticket data"); + return 2; + } + + retval = krb5_cc_default(context, &cc); + if (retval) { + com_err("uu-server", retval, "getting credentials cache"); + return 4; + } + + memset (&creds, 0, sizeof(creds)); + retval = krb5_cc_get_principal(context, cc, &creds.client); + if (retval) { + com_err("uu-client", retval, "getting principal name"); + return 6; + } + + /* client sends it already null-terminated. */ + printf ("uu-server: client principal is \"%s\".\n", pname_data.data); + + retval = krb5_parse_name(context, pname_data.data, &creds.server); + if (retval) { + com_err("uu-server", retval, "parsing client name"); + return 3; + } + + creds.second_ticket = tkt_data; + printf ("uu-server: client ticket is %d bytes.\n", + creds.second_ticket.length); + + retval = krb5_get_credentials(context, KRB5_GC_USER_USER, cc, + &creds, &new_creds); + if (retval) { + com_err("uu-server", retval, "getting user-user ticket"); + return 5; + } #ifndef DEBUG - l = sizeof(f_inaddr); - if (getpeername(0, (struct sockaddr *)&f_inaddr, &l) == -1) + l = sizeof(f_inaddr); + if (getpeername(0, (struct sockaddr *)&f_inaddr, &l) == -1) { - com_err("uu-server", errno, "getting client address"); - return 6; + com_err("uu-server", errno, "getting client address"); + return 6; } #endif - l = sizeof(l_inaddr); - if (getsockname(0, (struct sockaddr *)&l_inaddr, &l) == -1) + l = sizeof(l_inaddr); + if (getsockname(0, (struct sockaddr *)&l_inaddr, &l) == -1) { - com_err("uu-server", errno, "getting local address"); - return 6; - } - - /* send a ticket/authenticator to the other side, so it can get the key - we're using for the krb_safe below. */ - - retval = krb5_auth_con_init(context, &auth_context); - if (retval) { - com_err("uu-server", retval, "making auth_context"); - return 8; - } - - retval = krb5_auth_con_setflags(context, auth_context, - KRB5_AUTH_CONTEXT_DO_SEQUENCE); - if (retval) { - com_err("uu-server", retval, "initializing the auth_context flags"); - return 8; - } - - retval = - krb5_auth_con_genaddrs(context, auth_context, sock, - KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR | - KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR); - if (retval) { - com_err("uu-server", retval, "generating addrs for auth_context"); - return 9; - } + com_err("uu-server", errno, "getting local address"); + return 6; + } + + /* send a ticket/authenticator to the other side, so it can get the key + we're using for the krb_safe below. */ + + retval = krb5_auth_con_init(context, &auth_context); + if (retval) { + com_err("uu-server", retval, "making auth_context"); + return 8; + } + + retval = krb5_auth_con_setflags(context, auth_context, + KRB5_AUTH_CONTEXT_DO_SEQUENCE); + if (retval) { + com_err("uu-server", retval, "initializing the auth_context flags"); + return 8; + } + + retval = + krb5_auth_con_genaddrs(context, auth_context, sock, + KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR | + KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR); + if (retval) { + com_err("uu-server", retval, "generating addrs for auth_context"); + return 9; + } #if 1 - retval = krb5_mk_req_extended(context, &auth_context, - AP_OPTS_USE_SESSION_KEY, - NULL, new_creds, &msg); - if (retval) { - com_err("uu-server", retval, "making AP_REQ"); - return 8; - } - retval = krb5_write_message(context, (krb5_pointer) &sock, &msg); + retval = krb5_mk_req_extended(context, &auth_context, + AP_OPTS_USE_SESSION_KEY, + NULL, new_creds, &msg); + if (retval) { + com_err("uu-server", retval, "making AP_REQ"); + return 8; + } + retval = krb5_write_message(context, (krb5_pointer) &sock, &msg); #else - retval = krb5_sendauth(context, &auth_context, (krb5_pointer)&sock,"???", 0, - 0, AP_OPTS_MUTUAL_REQUIRED | AP_OPTS_USE_SESSION_KEY, - NULL, &creds, cc, NULL, NULL, NULL); + retval = krb5_sendauth(context, &auth_context, (krb5_pointer)&sock, "???", + 0, 0, + AP_OPTS_MUTUAL_REQUIRED | AP_OPTS_USE_SESSION_KEY, + NULL, &creds, cc, NULL, NULL, NULL); #endif - if (retval) - goto cl_short_wrt; + if (retval) + goto cl_short_wrt; - free(msg.data); + free(msg.data); - msgtext.length = 32; - msgtext.data = "Hello, other end of connection."; + msgtext.length = 32; + msgtext.data = "Hello, other end of connection."; - retval = krb5_mk_safe(context, auth_context, &msgtext, &msg, NULL); - if (retval) { - com_err("uu-server", retval, "encoding message to client"); - return 6; - } + retval = krb5_mk_safe(context, auth_context, &msgtext, &msg, NULL); + if (retval) { + com_err("uu-server", retval, "encoding message to client"); + return 6; + } - retval = krb5_write_message(context, (krb5_pointer) &sock, &msg); - if (retval) { - cl_short_wrt: - com_err("uu-server", retval, "writing message to client"); - return 7; - } + retval = krb5_write_message(context, (krb5_pointer) &sock, &msg); + if (retval) { + cl_short_wrt: + com_err("uu-server", retval, "writing message to client"); + return 7; + } - return 0; + return 0; } |