diff options
Diffstat (limited to 'source4/heimdal/lib/krb5')
-rw-r--r-- | source4/heimdal/lib/krb5/krb5.h | 6 | ||||
-rw-r--r-- | source4/heimdal/lib/krb5/log.c | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/source4/heimdal/lib/krb5/krb5.h b/source4/heimdal/lib/krb5/krb5.h index 13dafacf21..1f2e769728 100644 --- a/source4/heimdal/lib/krb5/krb5.h +++ b/source4/heimdal/lib/krb5/krb5.h @@ -52,7 +52,13 @@ #endif #ifndef KRB5_DEPRECATED +#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1 ))) #define KRB5_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) && (_MSC_VER>1200) +#define KRB5_DEPRECATED __declspec(deprecated) +#else +#define KRB5_DEPRECATED +#endif #endif /* simple constants */ diff --git a/source4/heimdal/lib/krb5/log.c b/source4/heimdal/lib/krb5/log.c index 31d267320f..ee5c1159b1 100644 --- a/source4/heimdal/lib/krb5/log.c +++ b/source4/heimdal/lib/krb5/log.c @@ -32,6 +32,7 @@ */ #include "krb5_locl.h" +#include <vis.h> struct facility { int min; @@ -218,11 +219,21 @@ log_file(const char *timestr, void *data) { struct file_data *f = data; + char *msgclean; + size_t len = strlen(msg) + 1; if(f->keep_open == 0) f->fd = fopen(f->filename, f->mode); if(f->fd == NULL) return; - fprintf(f->fd, "%s %s\n", timestr, msg); + /* make sure the log doesn't contain special chars */ + len *= 4; + msgclean = malloc(len); + if (msgclean == NULL) + goto out; + strvisx(rk_UNCONST(msg), msgclean, len, VIS_OCTAL); + fprintf(f->fd, "%s %s\n", timestr, msgclean); + free(msgclean); + out: if(f->keep_open == 0) { fclose(f->fd); f->fd = NULL; |