diff options
Diffstat (limited to 'src/lib/krb5/os/write_msg.c')
-rw-r--r-- | src/lib/krb5/os/write_msg.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/lib/krb5/os/write_msg.c b/src/lib/krb5/os/write_msg.c index e6001e8c67..6a57b1e0cb 100644 --- a/src/lib/krb5/os/write_msg.c +++ b/src/lib/krb5/os/write_msg.c @@ -1,3 +1,4 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * lib/krb5/os/write_msg.c * @@ -8,7 +9,7 @@ * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. - * + * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright @@ -22,7 +23,7 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. - * + * * * convenience sendauth/recvauth functions */ @@ -42,29 +43,29 @@ krb5int_write_messages(krb5_context context, krb5_pointer fdp, krb5_data *outbuf int fd = *( (int *) fdp); while (nbufs) { - int nbufs1; - sg_buf sg[4]; - krb5_int32 len[2]; + int nbufs1; + sg_buf sg[4]; + krb5_int32 len[2]; - if (nbufs > 1) - nbufs1 = 2; - else - nbufs1 = 1; - len[0] = htonl(outbuf[0].length); - SG_SET(&sg[0], &len[0], 4); - SG_SET(&sg[1], outbuf[0].length ? outbuf[0].data : NULL, - outbuf[0].length); - if (nbufs1 == 2) { - len[1] = htonl(outbuf[1].length); - SG_SET(&sg[2], &len[1], 4); - SG_SET(&sg[3], outbuf[1].length ? outbuf[1].data : NULL, - outbuf[1].length); - } - if (krb5int_net_writev(context, fd, sg, nbufs1 * 2) < 0) { - return errno; - } - outbuf += nbufs1; - nbufs -= nbufs1; + if (nbufs > 1) + nbufs1 = 2; + else + nbufs1 = 1; + len[0] = htonl(outbuf[0].length); + SG_SET(&sg[0], &len[0], 4); + SG_SET(&sg[1], outbuf[0].length ? outbuf[0].data : NULL, + outbuf[0].length); + if (nbufs1 == 2) { + len[1] = htonl(outbuf[1].length); + SG_SET(&sg[2], &len[1], 4); + SG_SET(&sg[3], outbuf[1].length ? outbuf[1].data : NULL, + outbuf[1].length); + } + if (krb5int_net_writev(context, fd, sg, nbufs1 * 2) < 0) { + return errno; + } + outbuf += nbufs1; + nbufs -= nbufs1; } return(0); } |