Imported Upstream version 1.8.7
[debian/sudo] / src / conversation.c
index fa40f791a0434174c477a8c18fb417c5ac038c1c..bab539ef799f92c468d467b58e92123bae2f54cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999-2005, 2007-2010 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 1999-2005, 2007-2012 Todd C. Miller <Todd.Miller@courtesan.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -21,7 +21,6 @@
 #include <config.h>
 
 #include <sys/types.h>
-#include <sys/param.h>
 #include <stdio.h>
 #ifdef STDC_HEADERS
 # include <stdlib.h>
@@ -47,6 +46,7 @@
 
 #include "sudo.h"
 #include "sudo_plugin.h"
+#include "sudo_plugin_int.h"
 
 extern int tgetpass_flags; /* XXX */
 
@@ -91,6 +91,10 @@ sudo_conversation(int num_msgs, const struct sudo_conv_message msgs[],
                if (msg->msg)
                    (void) fputs(msg->msg, stderr);
                break;
+           case SUDO_CONV_DEBUG_MSG:
+               if (msg->msg)
+                   sudo_debug_write(msg->msg, strlen(msg->msg), 0);
+               break;
            default:
                goto err;
        }
@@ -111,29 +115,3 @@ err:
 
     return -1;
 }
-
-int
-_sudo_printf(int msg_type, const char *fmt, ...)
-{
-    va_list ap;
-    FILE *fp;
-    int len;
-
-    switch (msg_type) {
-    case SUDO_CONV_INFO_MSG:
-       fp = stdout;
-       break;
-    case SUDO_CONV_ERROR_MSG:
-       fp = stderr;
-       break;
-    default:
-       errno = EINVAL;
-       return -1;
-    }
-
-    va_start(ap, fmt);
-    len = vfprintf(fp, fmt, ap);
-    va_end(ap);
-
-    return len;
-}