From 81f56139b6964ddbe2c03232475f87f474136490 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 11 Oct 2001 07:42:52 +0000 Subject: initial kerberos/ADS/SPNEGO support in libsmb and smbclient. To activate you need to: - install krb5 libraries - run configure - build smbclient - run kinit to get a TGT - run smbclient with the -k option to choose kerberos auth (This used to be commit d33057585644e1337bac743e25ed7653bfb39eef) --- source3/lib/util.c | 26 ++++++++++++++++++++++++++ source3/lib/util_file.c | 17 +++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/util.c b/source3/lib/util.c index 62e08333dd..20422a00c7 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1893,6 +1893,32 @@ BOOL unix_wild_match(char *pattern, char *string) return unix_do_match(p2, s2) == 0; } +/******************************************************************* + construct a data blob, must be freed with data_blob_free() +*******************************************************************/ +DATA_BLOB data_blob(void *p, size_t length) +{ + DATA_BLOB ret; + + if (!p) { + ZERO_STRUCT(ret); + return ret; + } + + ret.data = memdup(p, length); + ret.length = length; + return ret; +} + +/******************************************************************* +free a data blob +*******************************************************************/ +void data_blob_free(DATA_BLOB d) +{ + SAFE_FREE(d.data); +} + + #ifdef __INSURE__ /******************************************************************* diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 77c0d7888e..5ecf526280 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -573,3 +573,20 @@ void file_lines_slashcont(char **lines) } } } + +/* + save a lump of data into a file. Mostly used for debugging +*/ +BOOL file_save(const char *fname, void *packet, size_t length) +{ + int fd; + fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644); + if (fd == -1) { + return False; + } + if (write(fd, packet, length) != length) { + return False; + } + close(fd); + return True; +} -- cgit