mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
519d72c578
Fixes an error detected by buildroot autobuilders: http://autobuild.buildroot.net/results/573/573e2268e205e10d1352fa81122d8f225fdb4575/build-end.log /home/rclinux/rc-buildroot-test/scripts/instance-1/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/include/stdint.h:122:27: error: conflicting types for 'uintptr_t' typedef unsigned long int uintptr_t; ^ In file included from ../lib/ldb/tests/ldb_msg.c:17:0: ../third_party/cmocka/cmocka.h:126:28: note: previous declaration of 'uintptr_t' was here typedef unsigned int uintptr_t; The define __WORDSIZE is missing when cmocka.h decides how to define uintptr_t, this patch includes stdint.h when needed. Patch sent upstream: https://lists.samba.org/archive/samba-technical/2018-January/125306.html [updated for samba-4.8.4, v2 sent upstream https://lists.samba.org/archive/samba-technical/2018-August/129732.html, updated for samba-4.9.1] Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> [Retrieved from: https://git.buildroot.net/buildroot/tree/package/samba4/0003-Fix-uClibc-build-on-64bit-platforms-by-including-std.patch] Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Reviewed-by: Ralph Böhme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
64 lines
1.8 KiB
C
64 lines
1.8 KiB
C
/*
|
|
* Unix SMB/CIFS implementation.
|
|
* Test suite for ldap client
|
|
*
|
|
* Copyright (C) 2018 Andreas Schneider <asn@samba.org>
|
|
*
|
|
* 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/>.
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <setjmp.h>
|
|
#include <cmocka.h>
|
|
|
|
#include "source3/lib/tldap.c"
|
|
|
|
static void test_tldap_unescape_ldapv3(void **state)
|
|
{
|
|
const char *unescaped_dn = "(&(objectclass=group)(cn=Samba*))";
|
|
char dn[] = "\\28&\\28objectclass=group\\29\\28cn=Samba\\2a\\29\\29";
|
|
size_t dnlen = sizeof(dn);
|
|
bool ok;
|
|
|
|
ok = tldap_unescape_inplace(dn, &dnlen);
|
|
assert_true(ok);
|
|
|
|
assert_string_equal(dn, unescaped_dn);
|
|
}
|
|
|
|
static void test_tldap_unescape_ldapv2(void **state)
|
|
{
|
|
const char *unescaped_dn = "(&(objectclass=group)(cn=Samba*))";
|
|
char dn[] = "\\(&\\(objectclass=group\\)\\(cn=Samba\\*\\)\\)";
|
|
size_t dnlen = sizeof(dn);
|
|
bool ok;
|
|
|
|
ok = tldap_unescape_inplace(dn, &dnlen);
|
|
assert_true(ok);
|
|
|
|
assert_string_equal(dn, unescaped_dn);
|
|
}
|
|
|
|
int main(void) {
|
|
const struct CMUnitTest tests[] = {
|
|
cmocka_unit_test(test_tldap_unescape_ldapv3),
|
|
cmocka_unit_test(test_tldap_unescape_ldapv2)
|
|
};
|
|
|
|
cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
|
|
return cmocka_run_group_tests(tests, NULL, NULL);
|
|
}
|