summaryrefslogtreecommitdiff
path: root/source3/torture
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-06-25 18:18:50 +0200
committerGünther Deschner <gd@samba.org>2009-11-27 10:47:11 +0100
commitd6c60f8447ce92a15d48a35d3f21d881c4428663 (patch)
tree88f0591ca50d3cad17a0089d316619b620ef8ae4 /source3/torture
parente96f9a40ad46b8c08eaa81fde015dccc990388c5 (diff)
downloadsamba-d6c60f8447ce92a15d48a35d3f21d881c4428663.tar.gz
samba-d6c60f8447ce92a15d48a35d3f21d881c4428663.tar.bz2
samba-d6c60f8447ce92a15d48a35d3f21d881c4428663.zip
s3-nsstest: drastically shrink size and dependencies of nsstest binary.
The size went down from 6.4M to 104K on my box. Guenther
Diffstat (limited to 'source3/torture')
-rw-r--r--source3/torture/nsstest.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/source3/torture/nsstest.c b/source3/torture/nsstest.c
index 9832a7b5ac..8bb577e505 100644
--- a/source3/torture/nsstest.c
+++ b/source3/torture/nsstest.c
@@ -20,6 +20,13 @@
#include "includes.h"
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef realloc
+#undef realloc
+#endif
+
static const char *so_path = "/lib/libnss_winbind.so";
static const char *nss_name = "winbind";
static int nss_errno;
@@ -180,13 +187,13 @@ static struct group *nss_getgrent(void)
return NULL;
if (!buf)
- buf = SMB_MALLOC_ARRAY(char, buflen);
+ buf = (char *)malloc(buflen);
again:
status = _nss_getgrent_r(&grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
buflen *= 2;
- buf = SMB_REALLOC_ARRAY(buf, char, buflen);
+ buf = (char *)realloc(buf, buflen);
if (!buf) {
return NULL;
}
@@ -219,12 +226,12 @@ static struct group *nss_getgrnam(const char *name)
return NULL;
if (!buf)
- buf = SMB_MALLOC_ARRAY(char, buflen);
+ buf = (char *)malloc(buflen);
again:
status = _nss_getgrnam_r(name, &grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
buflen *= 2;
- buf = SMB_REALLOC_ARRAY(buf, char, buflen);
+ buf = (char *)realloc(buf, buflen);
if (!buf) {
return NULL;
}
@@ -257,13 +264,13 @@ static struct group *nss_getgrgid(gid_t gid)
return NULL;
if (!buf)
- buf = SMB_MALLOC_ARRAY(char, buflen);
+ buf = (char *)malloc(buflen);
again:
status = _nss_getgrgid_r(gid, &grp, buf, buflen, &nss_errno);
if (status == NSS_STATUS_TRYAGAIN) {
buflen *= 2;
- buf = SMB_REALLOC_ARRAY(buf, char, buflen);
+ buf = (char *)realloc(buf, buflen);
if (!buf) {
return NULL;
}
@@ -369,7 +376,7 @@ static void nss_test_initgroups(char *name, gid_t gid)
int i;
NSS_STATUS status;
- groups = SMB_MALLOC_ARRAY(gid_t, size);
+ groups = (gid_t *)malloc(size);
groups[0] = gid;
status = nss_initgroups(name, gid, &groups, &start, &size);