]> diplodocus.org Git - nmh/blobdiff - sbr/netsec.c
sendsbr.c: Move interface to own file.
[nmh] / sbr / netsec.c
index 1fe8f1ae5b04df7a6b2e84e43e3afa8e5c4134a8..3f0ea221356480ee70cd5ff389c0ea7d07c679ea 100644 (file)
@@ -6,10 +6,13 @@
  * complete copyright information.
  */
 
-#include <h/mh.h>
-#include <h/utils.h>
-#include <h/netsec.h>
-#include <h/oauth.h>
+#include "h/mh.h"
+#include "credentials.h"
+#include "getcpy.h"
+#include "brkstring.h"
+#include "h/utils.h"
+#include "h/netsec.h"
+#include "h/oauth.h"
 #include <stdarg.h>
 #include <sys/select.h>
 #include "base64.h"
@@ -288,7 +291,8 @@ netsec_set_snoop(netsec_context *nsc, int snoop)
  * Set the snoop callback for this connection.
  */
 
-void netsec_set_snoop_callback(netsec_context *nsc,
+void
+netsec_set_snoop_callback(netsec_context *nsc,
                               netsec_snoop_callback callback, void *context)
 {
     nsc->ns_snoop_cb = callback;
@@ -806,6 +810,7 @@ netsec_vprintf(netsec_context *nsc, char **errstr, const char *format,
               va_list ap)
 {
     int rc;
+    va_list apcopy;
 
     /*
      * Cheat a little.  If we can fit the data into our outgoing buffer,
@@ -813,8 +818,10 @@ netsec_vprintf(netsec_context *nsc, char **errstr, const char *format,
      */
 
 retry:
+    va_copy(apcopy, ap);
     rc = vsnprintf((char *) nsc->ns_outptr,
-                  nsc->ns_outbufsize - nsc->ns_outbuflen, format, ap);
+                  nsc->ns_outbufsize - nsc->ns_outbuflen, format, apcopy);
+    va_end(apcopy);
 
     if (rc >= (int) (nsc->ns_outbufsize - nsc->ns_outbuflen)) {
        /*
@@ -1103,7 +1110,8 @@ netsec_set_sasl_params(netsec_context *nsc, const char *service,
  * library when asked.
  */
 
-int netsec_get_user(void *context, int id, const char **result,
+int
+netsec_get_user(void *context, int id, const char **result,
                    unsigned int *len)
 {
     netsec_context *nsc = (netsec_context *) context;