diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-11-09 21:17:03 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-11-09 21:17:03 +0000 |
commit | 7a05ad0166ac11d4206d934825728b56a58d8edd (patch) | |
tree | 771b5f856eaa9e38ed4ef525ecefcf1b72e85949 /plugins/check_smtp.c | |
parent | 29471dda5ae9e750809e7a25b93d6bf6a2913bc2 (diff) | |
download | monitoring-plugins-7a05ad0166ac11d4206d934825728b56a58d8edd.tar.gz |
Moved base64 function to /lib.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1817 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r-- | plugins/check_smtp.c | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 79c7cd35..f44e5331 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -45,6 +45,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "common.h" #include "netutils.h" #include "utils.h" +#include "base64.h" #ifdef HAVE_SSL int check_cert = FALSE; @@ -122,46 +123,6 @@ enum { UDP_PROTOCOL = 2, }; -/* written by lauri alanko */ -static char * -base64 (const char *bin, size_t len) -{ - - char *buf = (char *) malloc ((len + 2) / 3 * 4 + 1); - size_t i = 0, j = 0; - - char BASE64_END = '='; - char base64_table[64]; - strncpy (base64_table, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", 64); - - while (j < len - 2) { - buf[i++] = base64_table[bin[j] >> 2]; - buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)]; - buf[i++] = base64_table[((bin[j + 1] & 15) << 2) | (bin[j + 2] >> 6)]; - buf[i++] = base64_table[bin[j + 2] & 63]; - j += 3; - } - - switch (len - j) { - case 1: - buf[i++] = base64_table[bin[j] >> 2]; - buf[i++] = base64_table[(bin[j] & 3) << 4]; - buf[i++] = BASE64_END; - buf[i++] = BASE64_END; - break; - case 2: - buf[i++] = base64_table[bin[j] >> 2]; - buf[i++] = base64_table[((bin[j] & 3) << 4) | (bin[j + 1] >> 4)]; - buf[i++] = base64_table[(bin[j + 1] & 15) << 2]; - buf[i++] = BASE64_END; - break; - case 0: - break; - } - - buf[i] = '\0'; - return buf; -} int main (int argc, char **argv) @@ -567,6 +528,7 @@ process_arguments (int argc, char **argv) break; case 'A': authtype = optarg; + use_ehlo = TRUE; break; case 'U': authuser = optarg; |