diff options
author | Volker Lendecke <vl@samba.org> | 2016-05-03 16:12:10 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2016-05-04 01:28:23 +0200 |
commit | 93b982faada860b6be178e0dcd4650bf7ca498aa (patch) | |
tree | 9490064432f053be94265375b2f3a60d0798974e /lib | |
parent | 9ec33323499cae77dba1ea3ff659d3cf59e9e2d4 (diff) | |
download | samba-93b982faada860b6be178e0dcd4650bf7ca498aa.tar.gz |
lib: Give base64.c its own .h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/base64.c | 1 | ||||
-rw-r--r-- | lib/util/base64.h | 52 | ||||
-rw-r--r-- | lib/util/charset/tests/convert_string.c | 1 | ||||
-rw-r--r-- | lib/util/samba_util.h | 21 |
4 files changed, 54 insertions, 21 deletions
diff --git a/lib/util/base64.c b/lib/util/base64.c index e01fb6d35e2..157cb347705 100644 --- a/lib/util/base64.c +++ b/lib/util/base64.c @@ -23,6 +23,7 @@ */ #include "includes.h" +#include "lib/util/base64.h" static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; diff --git a/lib/util/base64.h b/lib/util/base64.h new file mode 100644 index 00000000000..47638041d92 --- /dev/null +++ b/lib/util/base64.h @@ -0,0 +1,52 @@ +/* + * Unix SMB/CIFS implementation. + * Samba utility functions + * + * Copyright (C) Andrew Tridgell 1992-2001 + * Copyright (C) Simo Sorce 2001-2002 + * Copyright (C) Martin Pool 2003 + * Copyright (C) James Peach 2006 + * Copyright (C) Jeremy Allison 1992-2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __LIB_UTIL_BASE64_H__ +#define __LIB_UTIL_BASE64_H__ + +#include "replace.h" +#include "lib/util/data_blob.h" + +/** + Base64 decode a string, place into a data blob. Caller to + data_blob_free() the result. +**/ +DATA_BLOB base64_decode_data_blob_talloc(TALLOC_CTX *mem_ctx, const char *s); + +/** + Base64 decode a string, place into a data blob on NULL context. + Caller to data_blob_free() the result. +**/ +DATA_BLOB base64_decode_data_blob(const char *s); + +/** + Base64 decode a string, inplace +**/ +void base64_decode_inplace(char *s); +/** + Base64 encode a binary data blob into a string +**/ +char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data); + +#endif diff --git a/lib/util/charset/tests/convert_string.c b/lib/util/charset/tests/convert_string.c index 92de70295f8..e63fca650b0 100644 --- a/lib/util/charset/tests/convert_string.c +++ b/lib/util/charset/tests/convert_string.c @@ -22,6 +22,7 @@ #include "torture/torture.h" #include "lib/util/charset/charset.h" #include "param/param.h" +#include "lib/util/base64.h" struct torture_suite *torture_local_convert_string_handle(TALLOC_CTX *mem_ctx); struct torture_suite *torture_local_string_case_handle(TALLOC_CTX *mem_ctx); diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index 387e957ceca..c3391611627 100644 --- a/lib/util/samba_util.h +++ b/lib/util/samba_util.h @@ -303,27 +303,6 @@ _PUBLIC_ int strwicmp(const char *psz1, const char *psz2); _PUBLIC_ void string_replace(char *s, char oldc, char newc); /** - Base64 decode a string, place into a data blob. Caller to data_blob_free() the result. -**/ -_PUBLIC_ DATA_BLOB base64_decode_data_blob_talloc(TALLOC_CTX *mem_ctx, const char *s); - -/** - Base64 decode a string, place into a data blob on NULL context. - Caller to data_blob_free() the result. -**/ -_PUBLIC_ DATA_BLOB base64_decode_data_blob(const char *s); - - -/** - Base64 decode a string, inplace -**/ -_PUBLIC_ void base64_decode_inplace(char *s); -/** - Base64 encode a binary data blob into a string -**/ -_PUBLIC_ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data); - -/** * Compare 2 strings. * * @note The comparison is case-insensitive. |