svn commit: samba r18442 - in branches/SAMBA_4_0/source/lib/replace: . repdir test

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 06:11:53 + (Wed, 13 Sep 2006)
New Revision: 18442

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18442

Log:
run the os2_delete test in the testsuite too

that shows that Tru64 is broken...

It doesn't have getdirent() and the the replacement
code doesn't work there.

tridge: do you have any idea how to fix this?

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/Makefile.in
   branches/SAMBA_4_0/source/lib/replace/repdir/config.m4
   branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c
   branches/SAMBA_4_0/source/lib/replace/test/testsuite.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/Makefile.in
===
--- branches/SAMBA_4_0/source/lib/replace/Makefile.in   2006-09-13 04:03:58 UTC 
(rev 18441)
+++ branches/SAMBA_4_0/source/lib/replace/Makefile.in   2006-09-13 06:11:53 UTC 
(rev 18442)
@@ -36,7 +36,7 @@
 
 installcheck: install test
 
-TEST_OBJS = test/testsuite.o
+TEST_OBJS = test/testsuite.o test/os2_delete.o
 
 testsuite: libreplace.a $(TEST_OBJS)
$(CC) -o testsuite $(TEST_OBJS) -L. -lreplace

Modified: branches/SAMBA_4_0/source/lib/replace/repdir/config.m4
===
--- branches/SAMBA_4_0/source/lib/replace/repdir/config.m4  2006-09-13 
04:03:58 UTC (rev 18441)
+++ branches/SAMBA_4_0/source/lib/replace/repdir/config.m4  2006-09-13 
06:11:53 UTC (rev 18442)
@@ -1,15 +1,21 @@
 AC_CACHE_CHECK([for broken readdir],samba_cv_HAVE_BROKEN_READDIR,[
-   AC_TRY_RUN([#include $libreplacedir/test/os2_delete.c],
-  [samba_cv_HAVE_BROKEN_READDIR=no],
-  [samba_cv_HAVE_BROKEN_READDIR=yes],
-  [samba_cv_HAVE_BROKEN_READDIR=assuming not])])
+   AC_TRY_RUN([
+#define test_readdir_os2_delete main
+#include $libreplacedir/test/os2_delete.c],
+   [samba_cv_HAVE_BROKEN_READDIR=no],
+   [samba_cv_HAVE_BROKEN_READDIR=yes],
+   [samba_cv_HAVE_BROKEN_READDIR=assuming not])
+])
 
 if test x$samba_cv_HAVE_BROKEN_READDIR = xyes; then
 AC_CACHE_CHECK([for replacing readdir],samba_cv_REPLACE_READDIR,[
AC_TRY_RUN([
 #include $libreplacedir/repdir/repdir.c
+#define test_readdir_os2_delete main
 #include $libreplacedir/test/os2_delete.c],
-  samba_cv_REPLACE_READDIR=yes,samba_cv_REPLACE_READDIR=no)])
+   [samba_cv_REPLACE_READDIR=yes],
+   [samba_cv_REPLACE_READDIR=no])
+])
 fi
 
 SMB_ENABLE(REPLACE_READDIR, NO)

Modified: branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c
===
--- branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-09-13 
04:03:58 UTC (rev 18441)
+++ branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-09-13 
06:11:53 UTC (rev 18442)
@@ -12,9 +12,6 @@
 #include errno.h
 #include string.h
 #include fcntl.h
-#ifdef REPLACE_READDIR
-#include lib/replace/repdir/repdir.h
-#endif
 
 #define NUM_FILES 700
 #define READDIR_SIZE 100
@@ -22,8 +19,11 @@
 
 #define TESTDIR test.dir
 
-#define FAILED(d) (fprintf(stderr, Failed for %s - %s\n, d, 
strerror(errno)), exit(1), 1)
+static int test_readdir_os2_delete_ret;
 
+#define FAILED(d) (fprintf(stderr, Failed for %s - %s\n, d, 
strerror(errno)), test_readdir_os2_delete_ret = 1, 1)
+#define CHECK do { if (test_readdir_os2_delete_ret != 0) return 
test_readdir_os2_delete_ret; } while (0)
+
 #ifndef MIN
 #define MIN(a,b) ((a)(b)?(a):(b))
 #endif
@@ -78,7 +78,7 @@
return j;
 }
 
-int main(void)
+int test_readdir_os2_delete(void)
 {
int total_deleted = 0;
DIR *d;

Modified: branches/SAMBA_4_0/source/lib/replace/test/testsuite.c
===
--- branches/SAMBA_4_0/source/lib/replace/test/testsuite.c  2006-09-13 
04:03:58 UTC (rev 18441)
+++ branches/SAMBA_4_0/source/lib/replace/test/testsuite.c  2006-09-13 
06:11:53 UTC (rev 18442)
@@ -229,8 +229,15 @@
return true;
 }
 
-static int test_readdir(void)
+extern int test_readdir_os2_delete(void);
+
+static bool test_readdir(void)
 {
+   printf(testing readdir\n);
+   if (test_readdir_os2_delete() != 0) {
+   return false;
+   }
+
/* FIXME */
return true;
 }



svn commit: samba r18443 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 06:28:14 + (Wed, 13 Sep 2006)
New Revision: 18443

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18443

Log:
add object files only when needed

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/getpass.m4
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/getpass.m4
===
--- branches/SAMBA_4_0/source/lib/replace/getpass.m42006-09-13 06:11:53 UTC 
(rev 18442)
+++ branches/SAMBA_4_0/source/lib/replace/getpass.m42006-09-13 06:28:14 UTC 
(rev 18443)
@@ -13,4 +13,5 @@
 ])
 if test x$samba_cv_REPLACE_GETPASS = xyes; then
AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
+   LIBREPLACEOBJ=${LIBREPLACEOBJ} getpass.o
 fi

Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 06:11:53 UTC 
(rev 18442)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 06:28:14 UTC 
(rev 18443)
@@ -8,9 +8,11 @@
break;
fi
 done
-LIBREPLACEOBJ=dlfcn.o getpass.o replace.o snprintf.o timegm.o
+LIBREPLACEOBJ=replace.o
 AC_SUBST(LIBREPLACEOBJ)
 
+LIBREPLACEOBJ=${LIBREPLACEOBJ} dlfcn.o snprintf.o timegm.o
+
 dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable 
it
 dnl which conflicts with C99 on HPUX
 ac_cv_prog_cc_Ae=no



svn commit: samba r18444 - in branches/SAMBA_4_0/source/lib/replace/test: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 07:35:42 + (Wed, 13 Sep 2006)
New Revision: 18444

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18444

Log:
return the correct value on error

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c
===
--- branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-09-13 
06:28:14 UTC (rev 18443)
+++ branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-09-13 
07:35:42 UTC (rev 18444)
@@ -22,7 +22,6 @@
 static int test_readdir_os2_delete_ret;
 
 #define FAILED(d) (fprintf(stderr, Failed for %s - %s\n, d, 
strerror(errno)), test_readdir_os2_delete_ret = 1, 1)
-#define CHECK do { if (test_readdir_os2_delete_ret != 0) return 
test_readdir_os2_delete_ret; } while (0)
 
 #ifndef MIN
 #define MIN(a,b) ((a)(b)?(a):(b))
@@ -84,6 +83,8 @@
DIR *d;
struct dirent *de;
 
+   test_readdir_os2_delete_ret = 0;
+
cleanup();
create_files();

@@ -106,5 +107,5 @@
 
rmdir(TESTDIR) == 0 || FAILED(rmdir);
 
-   return 0;
+   return test_readdir_os2_delete_ret;
 }



svn commit: samba r18445 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 08:14:10 + (Wed, 13 Sep 2006)
New Revision: 18445

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18445

Log:
splitout the dlfcn related tests

metze
Added:
   branches/SAMBA_4_0/source/lib/replace/dlfcn.m4
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4


Changeset:
Added: branches/SAMBA_4_0/source/lib/replace/dlfcn.m4
===
--- branches/SAMBA_4_0/source/lib/replace/dlfcn.m4  2006-09-13 07:35:42 UTC 
(rev 18444)
+++ branches/SAMBA_4_0/source/lib/replace/dlfcn.m4  2006-09-13 08:14:10 UTC 
(rev 18445)
@@ -0,0 +1,18 @@
+dnl dummies provided by dlfcn.c if not available
+save_LIBS=$LIBS
+LIBS=
+
+AC_SEARCH_LIBS(dlopen, dl)
+
+AC_CHECK_HEADERS(dlfcn.h)
+
+libreplace_dlfcn=no
+AC_CHECK_FUNCS([dlopen dlsym dlerror dlclose],[],[libreplace_dlfcn=yes])
+
+if test x${libreplace_dlfcn} = xyes;then
+   LIBREPLACEOBJ=${LIBREPLACEOBJ} dlfcn.o
+fi
+
+LIBDL=$LIBS
+AC_SUBST(LIBDL)
+LIBS=$save_LIBS

Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 07:35:42 UTC 
(rev 18444)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 08:14:10 UTC 
(rev 18445)
@@ -11,7 +11,7 @@
 LIBREPLACEOBJ=replace.o
 AC_SUBST(LIBREPLACEOBJ)
 
-LIBREPLACEOBJ=${LIBREPLACEOBJ} dlfcn.o snprintf.o timegm.o
+LIBREPLACEOBJ=${LIBREPLACEOBJ} snprintf.o timegm.o
 
 dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable 
it
 dnl which conflicts with C99 on HPUX
@@ -235,19 +235,11 @@
 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant 
vsnprintf])
 fi
 
-dnl dummies provided by dlfcn.c if not available
-save_LIBS=$LIBS
-LIBS=
-AC_SEARCH_LIBS(dlopen, dl)
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
-LIBDL=$LIBS
-AC_SUBST(LIBDL)
-LIBS=$save_LIBS
 
 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
   [AC_MSG_ERROR([Required function not found])])
 
+m4_include(dlfcn.m4)
 m4_include(getpass.m4)
 m4_include(system/config.m4)
 



svn commit: samba r18446 - in branches/SAMBA_3_0/source: libads utils

2006-09-13 Thread jra
Author: jra
Date: 2006-09-13 09:03:42 + (Wed, 13 Sep 2006)
New Revision: 18446

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18446

Log:
Add the ldap 'leave domain' code - call this as
a non-fatal error path if the 'disable machine
account' code succeeded.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libads/ldap.c
   branches/SAMBA_3_0/source/utils/net_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===
--- branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 08:14:10 UTC (rev 
18445)
+++ branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 09:03:42 UTC (rev 
18446)
@@ -2818,4 +2818,178 @@
return name;
 }
 
+#if 0
+
+   SAVED CODE - we used to join via ldap - remember how we did this. JRA.
+
+/**
+ * Join a machine to a realm
+ *  Creates the machine account and sets the machine password
+ * @param ads connection to ads server
+ * @param machine name of host to add
+ * @param org_unit Organizational unit to place machine in
+ * @return status of join
+ **/
+ADS_STATUS ads_join_realm(ADS_STRUCT *ads, const char *machine_name,
+   uint32 account_type, const char *org_unit)
+{
+   ADS_STATUS status;
+   LDAPMessage *res = NULL;
+   char *machine;
+
+   /* machine name must be lowercase */
+   machine = SMB_STRDUP(machine_name);
+   strlower_m(machine);
+
+   /*
+   status = ads_find_machine_acct(ads, (void **)res, machine);
+   if (ADS_ERR_OK(status)  ads_count_replies(ads, res) == 1) {
+   DEBUG(0, (Host account for %s already exists - deleting old 
account\n, machine));
+   status = ads_leave_realm(ads, machine);
+   if (!ADS_ERR_OK(status)) {
+   DEBUG(0, (Failed to delete host '%s' from the '%s' 
realm.\n,
+   machine, ads-config.realm));
+   return status;
+   }
+   }
+   */
+   status = ads_add_machine_acct(ads, machine, account_type, org_unit);
+   if (!ADS_ERR_OK(status)) {
+   DEBUG(0, (ads_join_realm: ads_add_machine_acct failed (%s): 
%s\n, machine, ads_errstr(status)));
+   SAFE_FREE(machine);
+   return status;
+   }
+
+   status = ads_find_machine_acct(ads, (void **)(void *)res, machine);
+   if (!ADS_ERR_OK(status)) {
+   DEBUG(0, (ads_join_realm: Host account test failed for machine 
%s\n, machine));
+   SAFE_FREE(machine);
+   return status;
+   }
+
+   SAFE_FREE(machine);
+   ads_msgfree(ads, res);
+
+   return status;
+}
 #endif
+
+/**
+ * Delete a machine from the realm
+ * @param ads connection to ads server
+ * @param hostname Machine to remove
+ * @return status of delete
+ **/
+ADS_STATUS ads_leave_realm(ADS_STRUCT *ads, const char *hostname)
+{
+   ADS_STATUS status;
+   void *msg;
+   LDAPMessage *res;
+   char *hostnameDN, *host;
+   int rc;
+   LDAPControl ldap_control;
+   LDAPControl  * pldap_control[2] = {NULL, NULL};
+
+   pldap_control[0] = ldap_control;
+   memset(ldap_control, 0, sizeof(LDAPControl));
+   ldap_control.ldctl_oid = (char *)LDAP_SERVER_TREE_DELETE_OID;
+
+   /* hostname must be lowercase */
+   host = SMB_STRDUP(hostname);
+   strlower_m(host);
+
+   status = ads_find_machine_acct(ads, res, host);
+   if (!ADS_ERR_OK(status)) {
+   DEBUG(0, (Host account for %s does not exist.\n, host));
+   SAFE_FREE(host);
+   return status;
+   }
+
+   msg = ads_first_entry(ads, res);
+   if (!msg) {
+   SAFE_FREE(host);
+   return ADS_ERROR_SYSTEM(ENOENT);
+   }
+
+   hostnameDN = ads_get_dn(ads, (LDAPMessage *)msg);
+
+   rc = ldap_delete_ext_s(ads-ld, hostnameDN, pldap_control, NULL);
+   if (rc) {
+   DEBUG(3,(ldap_delete_ext_s failed with error code %d\n, rc));
+   }else {
+   DEBUG(3,(ldap_delete_ext_s succeeded with error code %d\n, 
rc));
+   }
+
+   ads_memfree(ads, hostnameDN);
+   if (rc != LDAP_SUCCESS) {
+   const char *attrs[] = { cn, NULL };
+   void *msg_sub;
+
+   /* we only search with scope ONE, we do not expect any further
+* objects to be created deeper */
+
+   status = ads_do_search_retry(ads, hostnameDN, LDAP_SCOPE_ONE,
+   (objectclass=*), attrs, res);
+
+   if (!ADS_ERR_OK(status)) {
+   SAFE_FREE(host);
+   ads_memfree(ads, hostnameDN);
+   return status;
+   }
+
+   for (msg_sub = ads_first_entry(ads, res); msg_sub;
+   msg_sub = ads_next_entry(ads, msg_sub)) {
+
+   char *dn = NULL;
+
+   if ((dn 

svn commit: samba r18447 - in branches/SAMBA_4_0/source: . include

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 09:23:05 + (Wed, 13 Sep 2006)
New Revision: 18447

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18447

Log:
make sure we bail out if the config.h is not generated
by samba's configure.

this could happen when you have done a standalone build in
lib/replace/, lib/talloc, ...

metze
Modified:
   branches/SAMBA_4_0/source/configure.ac
   branches/SAMBA_4_0/source/include/includes.h


Changeset:
Modified: branches/SAMBA_4_0/source/configure.ac
===
--- branches/SAMBA_4_0/source/configure.ac  2006-09-13 09:03:42 UTC (rev 
18446)
+++ branches/SAMBA_4_0/source/configure.ac  2006-09-13 09:23:05 UTC (rev 
18447)
@@ -8,6 +8,7 @@
 
 AC_CONFIG_SRCDIR([include/includes.h])
 AC_CONFIG_HEADER(include/config_tmp.h)
+AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h])
 
 # Configuration rules.
 m4_include(lib/replace/libreplace.m4)

Modified: branches/SAMBA_4_0/source/include/includes.h
===
--- branches/SAMBA_4_0/source/include/includes.h2006-09-13 09:03:42 UTC 
(rev 18446)
+++ branches/SAMBA_4_0/source/include/includes.h2006-09-13 09:23:05 UTC 
(rev 18447)
@@ -23,8 +23,15 @@
 
 #ifndef NO_CONFIG_H /* for some tests */
 #include lib/replace/replace.h
+
+/* make sure we have included the correct config.h */
+#ifndef CONFIG_H_IS_FROM_SAMBA
+#warn  make sure you have removed all config.h files from standalone builds!
+#error the included config.h isn't from samba!
 #endif
 
+#endif /* NO_CONFIG_H */
+ 
 #include local.h
 
 #ifdef __GNUC__



svn commit: samba r18448 - in branches/SAMBA_4_0/source/include: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 09:27:33 + (Wed, 13 Sep 2006)
New Revision: 18448

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18448

Log:
this gives nicer output...

metze
Modified:
   branches/SAMBA_4_0/source/include/includes.h


Changeset:
Modified: branches/SAMBA_4_0/source/include/includes.h
===
--- branches/SAMBA_4_0/source/include/includes.h2006-09-13 09:23:05 UTC 
(rev 18447)
+++ branches/SAMBA_4_0/source/include/includes.h2006-09-13 09:27:33 UTC 
(rev 18448)
@@ -26,7 +26,7 @@
 
 /* make sure we have included the correct config.h */
 #ifndef CONFIG_H_IS_FROM_SAMBA
-#warn  make sure you have removed all config.h files from standalone builds!
+#error make sure you have removed all config.h files from standalone builds!
 #error the included config.h isn't from samba!
 #endif
 



svn commit: samba r18449 - in branches/SAMBA_3_0/source: . lib

2006-09-13 Thread vlendec
Author: vlendec
Date: 2006-09-13 09:32:24 + (Wed, 13 Sep 2006)
New Revision: 18449

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18449

Log:
Attempt to fix the build on non-linux platforms: Many of those don't have
strtoull. This is a copy of the stuff in samba4 libreplace, which is GPL. I
hope it is ok to copypaste it into a GPL file. Tridge, we could also create a
replace_lpgl.c if needed.

Volker

Modified:
   branches/SAMBA_3_0/source/configure.in
   branches/SAMBA_3_0/source/lib/replace.c


Changeset:
Modified: branches/SAMBA_3_0/source/configure.in
===
--- branches/SAMBA_3_0/source/configure.in  2006-09-13 09:27:33 UTC (rev 
18448)
+++ branches/SAMBA_3_0/source/configure.in  2006-09-13 09:32:24 UTC (rev 
18449)
@@ -1274,7 +1274,7 @@
 fi
 
 AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup 
strnlen strerror chown fchown chmod fchmod chroot link mknod mknod64)
-AC_CHECK_FUNCS(strtol strtoll strtoul strtoull)
+AC_CHECK_FUNCS(strtol strtoll strtoul strtoull strtouq __strtoull)
 AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync memset strlcpy 
strlcat setpgid)
 AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob 
strpbrk pipe crypt16 getauthuid)
 AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr 
setnetgrent getnetgrent endnetgrent)

Modified: branches/SAMBA_3_0/source/lib/replace.c
===
--- branches/SAMBA_3_0/source/lib/replace.c 2006-09-13 09:27:33 UTC (rev 
18448)
+++ branches/SAMBA_3_0/source/lib/replace.c 2006-09-13 09:32:24 UTC (rev 
18449)
@@ -415,6 +415,21 @@
 }
 #endif /* HAVE_STRTOUL */
 
+#ifndef HAVE_STRTOULL
+unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
+{
+#ifdef HAVE_STRTOUQ
+   return strtouq(str, endptr, base);
+#elif defined(HAVE___STRTOULL) 
+   return __strtoull(str, endptr, base);
+#elif SIZEOF_LONG == SIZEOF_LONG_LONG
+   return (unsigned long long int) strtoul(str, endptr, base);
+#else
+# error You need a strtoull function
+#endif
+}
+#endif
+
 #ifndef HAVE_SETLINEBUF
  int setlinebuf(FILE *stream)
 {



svn commit: samba r18450 - in branches/SAMBA_4_0/source: . lib lib/replace lib/replace/repdir

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 09:47:41 + (Wed, 13 Sep 2006)
New Revision: 18450

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18450

Log:
- autogenerate the OBJ_FILES for LIBREPLACE
- remove samba specific stuff from libreplace
- and include the readdir replacement stuff in the standalone builds

metze
Added:
   branches/SAMBA_4_0/source/lib/replace/samba.m4
Removed:
   branches/SAMBA_4_0/source/lib/replace/config.mk
Modified:
   branches/SAMBA_4_0/source/configure.ac
   branches/SAMBA_4_0/source/lib/basic.mk
   branches/SAMBA_4_0/source/lib/replace/configure.ac
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4
   branches/SAMBA_4_0/source/lib/replace/repdir/config.m4


Changeset:
Modified: branches/SAMBA_4_0/source/configure.ac
===
--- branches/SAMBA_4_0/source/configure.ac  2006-09-13 09:32:24 UTC (rev 
18449)
+++ branches/SAMBA_4_0/source/configure.ac  2006-09-13 09:47:41 UTC (rev 
18450)
@@ -11,11 +11,8 @@
 AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h])
 
 # Configuration rules.
-m4_include(lib/replace/libreplace.m4)
+m4_include(lib/replace/samba.m4)
 m4_include(build/m4/env.m4)
-SMB_EXT_LIB(DL, $LIBDL)
-m4_include(lib/replace/win32/config.m4)
-m4_include(lib/replace/repdir/config.m4)
 m4_include(lib/smbreadline/readline.m4)
 m4_include(heimdal_build/config.m4)
 m4_include(lib/util/fault.m4)

Modified: branches/SAMBA_4_0/source/lib/basic.mk
===
--- branches/SAMBA_4_0/source/lib/basic.mk  2006-09-13 09:32:24 UTC (rev 
18449)
+++ branches/SAMBA_4_0/source/lib/basic.mk  2006-09-13 09:47:41 UTC (rev 
18450)
@@ -12,7 +12,6 @@
 include cmdline/config.mk
 include socket_wrapper/config.mk
 include appweb/config.mk
-include replace/config.mk
 include stream/config.mk
 include util/config.mk
 include tdr/config.mk

Deleted: branches/SAMBA_4_0/source/lib/replace/config.mk
===
--- branches/SAMBA_4_0/source/lib/replace/config.mk 2006-09-13 09:32:24 UTC 
(rev 18449)
+++ branches/SAMBA_4_0/source/lib/replace/config.mk 2006-09-13 09:47:41 UTC 
(rev 18450)
@@ -1,29 +0,0 @@
-##
-# Start SUBSYSTEM REPLACE_READDIR
-[SUBSYSTEM::REPLACE_READDIR]
-OBJ_FILES = \
-   repdir/repdir.o
-# End SUBSYSTEM REPLACE_READDIR
-##
-
-##
-# Start SUBSYSTEM LIBREPLACE
-[SUBSYSTEM::LIBREPLACE]
-CFLAGS = -Ilib/replace
-OBJ_FILES = replace.o \
-   snprintf.o \
-   dlfcn.o \
-   getpass.o \
-   timegm.o
-PUBLIC_DEPENDENCIES = REPLACE_READDIR DL
-# End SUBSYSTEM LIBREPLACE
-##
-
-[SUBSYSTEM::LIBREPLACE_HOSTCC]
-CFLAGS = -Ilib/replace
-OBJ_FILES = replace.ho \
-   snprintf.ho \
-   dlfcn.ho \
-   getpass.ho \
-   timegm.ho
-

Modified: branches/SAMBA_4_0/source/lib/replace/configure.ac
===
--- branches/SAMBA_4_0/source/lib/replace/configure.ac  2006-09-13 09:32:24 UTC 
(rev 18449)
+++ branches/SAMBA_4_0/source/lib/replace/configure.ac  2006-09-13 09:47:41 UTC 
(rev 18450)
@@ -1,16 +1,12 @@
-AC_DEFUN([SMB_EXT_LIB], [echo -n ])
-AC_DEFUN([SMB_ENABLE], [echo -n ])
-
 AC_PREREQ(2.50)
-AC_INIT(dlfcn.c)
-AC_CONFIG_SRCDIR([dlfcn.c])
+AC_INIT(replace.c)
+AC_CONFIG_SRCDIR([replace.c])
 AC_CONFIG_HEADER(config.h)
 
+m4_include(libreplace.m4)
+
 if test $ac_cv_prog_gcc = yes; then
CFLAGS=$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith 
-Wcast-qual -Wcast-align -Wwrite-strings
 fi
 
-m4_include(libreplace.m4)
-m4_include(win32/config.m4)
-m4_include(repdir/config.m4)
 AC_OUTPUT(Makefile)

Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 09:32:24 UTC 
(rev 18449)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 09:47:41 UTC 
(rev 18450)
@@ -236,13 +236,6 @@
 fi
 
 
-AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
-  [AC_MSG_ERROR([Required function not found])])
-
-m4_include(dlfcn.m4)
-m4_include(getpass.m4)
-m4_include(system/config.m4)
-
 LIBREPLACE_C99_STRUCT_INIT(c99_struct_initialization=yes,
c99_struct_initialization=no)
 
@@ -344,3 +337,12 @@
 if test x$samba_cv_volatile = xyes; then
AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands 
volatile])
 fi
+
+m4_include(dlfcn.m4)
+m4_include(getpass.m4)
+m4_include(system/config.m4)
+m4_include(win32/config.m4)
+m4_include(repdir/config.m4)
+
+AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
+  [AC_MSG_ERROR([Required function not 

svn commit: samba r18451 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 09:56:21 + (Wed, 13 Sep 2006)
New Revision: 18451

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18451

Log:
move repdir/ into the top dir

metze
Added:
   branches/SAMBA_4_0/source/lib/replace/repdir.m4
   branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c
Removed:
   branches/SAMBA_4_0/source/lib/replace/repdir/
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 09:47:41 UTC 
(rev 18450)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 09:56:21 UTC 
(rev 18451)
@@ -342,7 +342,7 @@
 m4_include(getpass.m4)
 m4_include(system/config.m4)
 m4_include(win32/config.m4)
-m4_include(repdir/config.m4)
+m4_include(repdir.m4)
 
 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
   [AC_MSG_ERROR([Required function not found])])

Copied: branches/SAMBA_4_0/source/lib/replace/repdir.m4 (from rev 18450, 
branches/SAMBA_4_0/source/lib/replace/repdir/config.m4)
===
--- branches/SAMBA_4_0/source/lib/replace/repdir/config.m4  2006-09-13 
09:47:41 UTC (rev 18450)
+++ branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 09:56:21 UTC 
(rev 18451)
@@ -0,0 +1,30 @@
+AC_CACHE_CHECK([for broken readdir],libreplace_READDIR_NEEDED,[
+   AC_TRY_RUN([
+#define test_readdir_os2_delete main
+#error
+#include $libreplacedir/test/os2_delete.c],
+   [libreplace_READDIR_NEEDED=no],
+   [libreplace_READDIR_NEEDED=yes],
+   [libreplace_READDIR_NEEDED=assuming not])
+])
+
+#
+# try to replace with getdents() if needed
+#
+if test x$libreplace_READDIR_NEEDED = xyes; then
+AC_CACHE_CHECK([for replacing readdir using 
getdents()],libreplace_READDIR_GETDENTS,[
+   AC_TRY_RUN([
+#include confdefs.h
+#include $libreplacedir/repdir_getdents.c
+#define test_readdir_os2_delete main
+#include $libreplacedir/test/os2_delete.c],
+   [libreplace_READDIR_GETDENTS=yes],
+   [libreplace_READDIR_GETDENTS=no])
+])
+fi
+if test x$libreplace_READDIR_GETDENTS = xyes; then
+   AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
+   AC_DEFINE(REPLACE_READDIR_GETDENTS,1,[replace readdir using getdents()])
+   LIBREPLACEOBJ=${LIBREPLACEOBJ} repdir_getdents.o
+   libreplace_READDIR_NEEDED=no
+fi

Copied: branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c (from rev 
18420, branches/SAMBA_4_0/source/lib/replace/repdir/repdir.c)



svn commit: samba r18452 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 10:00:45 + (Wed, 13 Sep 2006)
New Revision: 18452

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18452

Log:
add configure test for a getdirentries() based replacement for broken readdir()

Tru64 need this, linux also has getdirentries() but the native readdir() works
but it means we can write the code on linux and when it works it may work on 
Tru64
too.

tridge: can you try to implement this?

metze
Added:
   branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir.m4
===
--- branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 09:56:21 UTC 
(rev 18451)
+++ branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 10:00:45 UTC 
(rev 18452)
@@ -28,3 +28,28 @@
LIBREPLACEOBJ=${LIBREPLACEOBJ} repdir_getdents.o
libreplace_READDIR_NEEDED=no
 fi
+
+#
+# try to replace with getdirentries() if needed
+#
+if test x$libreplace_READDIR_NEEDED = xyes; then
+AC_CACHE_CHECK([for replacing readdir using 
getdirentries()],libreplace_READDIR_GETDIRENTRIES,[
+   AC_TRY_RUN([
+#include confdefs.h
+#include $libreplacedir/repdir_getdirentries.c
+#define test_readdir_os2_delete main
+#include $libreplacedir/test/os2_delete.c],
+   [libreplace_READDIR_GETDIRENTRIES=yes],
+   [libreplace_READDIR_GETDIRENTRIES=no])
+])
+fi
+if test x$libreplace_READDIR_GETDIRENTRIES = xyes; then
+   AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
+   AC_DEFINE(REPLACE_READDIR_GETDIRENTRIES,1,[replace readdir using 
getdirentries()])
+   LIBREPLACEOBJ=${LIBREPLACEOBJ} repdir_getdirentries.o
+   libreplace_READDIR_NEEDED=no
+fi
+
+if test x$libreplace_READDIR_NEEDED = xyes; then
+   AC_MSG_WARN([the provides readdir() is broken])
+fi

Added: branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
===
--- branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-13 09:56:21 UTC (rev 18451)
+++ branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-13 10:00:45 UTC (rev 18452)
@@ -0,0 +1 @@
+#error the readdir() replacement using getdirentried() isn't implemented yet



svn commit: samba r18453 - in branches/SAMBA_3_0/source/libads: .

2006-09-13 Thread vlendec
Author: vlendec
Date: 2006-09-13 10:03:27 + (Wed, 13 Sep 2006)
New Revision: 18453

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18453

Log:
Attempt to fix the non-ldap build
Modified:
   branches/SAMBA_3_0/source/libads/ldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===
--- branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 10:00:45 UTC (rev 
18452)
+++ branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 10:03:27 UTC (rev 
18453)
@@ -2874,6 +2874,8 @@
 }
 #endif
 
+#ifdef HAVE_LDAP
+
 /**
  * Delete a machine from the realm
  * @param ads connection to ads server
@@ -2993,3 +2995,5 @@
return status;
 }
 #endif
+
+#endif



svn commit: samba r18454 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 10:04:46 + (Wed, 13 Sep 2006)
New Revision: 18454

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18454

Log:
this was just for debugging...

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir.m4
===
--- branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 10:03:27 UTC 
(rev 18453)
+++ branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 10:04:46 UTC 
(rev 18454)
@@ -1,7 +1,6 @@
 AC_CACHE_CHECK([for broken readdir],libreplace_READDIR_NEEDED,[
AC_TRY_RUN([
 #define test_readdir_os2_delete main
-#error
 #include $libreplacedir/test/os2_delete.c],
[libreplace_READDIR_NEEDED=no],
[libreplace_READDIR_NEEDED=yes],



svn commit: samba r18455 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 10:10:20 + (Wed, 13 Sep 2006)
New Revision: 18455

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18455

Log:
check if getdents() and getdirentries() are available.
(only for the nicer configure output)

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir.m4
===
--- branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 10:04:46 UTC 
(rev 18454)
+++ branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 10:10:20 UTC 
(rev 18455)
@@ -11,6 +11,7 @@
 # try to replace with getdents() if needed
 #
 if test x$libreplace_READDIR_NEEDED = xyes; then
+AC_CHECK_FUNCS(getdents)
 AC_CACHE_CHECK([for replacing readdir using 
getdents()],libreplace_READDIR_GETDENTS,[
AC_TRY_RUN([
 #include confdefs.h
@@ -32,6 +33,7 @@
 # try to replace with getdirentries() if needed
 #
 if test x$libreplace_READDIR_NEEDED = xyes; then
+AC_CHECK_FUNCS(getdirentries)
 AC_CACHE_CHECK([for replacing readdir using 
getdirentries()],libreplace_READDIR_GETDIRENTRIES,[
AC_TRY_RUN([
 #include confdefs.h



svn commit: samba r18456 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 10:12:03 + (Wed, 13 Sep 2006)
New Revision: 18456

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18456

Log:
Tru64 doesn't have getdents() so we don't need this ifdef's...

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c
===
--- branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c 2006-09-13 
10:10:20 UTC (rev 18455)
+++ branches/SAMBA_4_0/source/lib/replace/repdir_getdents.c 2006-09-13 
10:12:03 UTC (rev 18456)
@@ -118,11 +118,7 @@
return d-seekpos + d-ofs;
 }
 
-#ifdef _OSF_SOURCE
-int seekdir(DIR *dir, long ofs)
-#else
 void seekdir(DIR *dir, long ofs)
-#endif
 {
struct dir_buf *d = (struct dir_buf *)dir;
d-seekpos = lseek(d-fd, ofs  ~(DIR_BUF_SIZE-1), SEEK_SET);
@@ -131,9 +127,6 @@
while (d-ofs  (ofs  (DIR_BUF_SIZE-1))) {
if (readdir(dir) == NULL) break;
}
-#ifdef _OSF_SOURCE
-   return -1;
-#endif
 }
 
 void rewinddir(DIR *dir)



svn commit: samba r18457 - in branches/SAMBA_3_0/source/lib: .

2006-09-13 Thread vlendec
Author: vlendec
Date: 2006-09-13 10:12:55 + (Wed, 13 Sep 2006)
New Revision: 18457

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18457

Log:
Argl :-)
Modified:
   branches/SAMBA_3_0/source/lib/replace.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/replace.c
===
--- branches/SAMBA_3_0/source/lib/replace.c 2006-09-13 10:12:03 UTC (rev 
18456)
+++ branches/SAMBA_3_0/source/lib/replace.c 2006-09-13 10:12:55 UTC (rev 
18457)
@@ -416,7 +416,7 @@
 #endif /* HAVE_STRTOUL */
 
 #ifndef HAVE_STRTOULL
-unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
+unsigned long long int strtoull(const char *str, char **endptr, int base)
 {
 #ifdef HAVE_STRTOUQ
return strtouq(str, endptr, base);



svn commit: samba r18458 - in branches/SAMBA_4_0/source/lib/replace: . win32

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 10:13:01 + (Wed, 13 Sep 2006)
New Revision: 18458

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18458

Log:
move wins32 stuff to the top dir

metze
Added:
   branches/SAMBA_4_0/source/lib/replace/win32.m4
   branches/SAMBA_4_0/source/lib/replace/win32_replace.h
Removed:
   branches/SAMBA_4_0/source/lib/replace/win32/config.m4
   branches/SAMBA_4_0/source/lib/replace/win32/replace.h
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4
   branches/SAMBA_4_0/source/lib/replace/replace.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 10:12:55 UTC 
(rev 18457)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 10:13:01 UTC 
(rev 18458)
@@ -340,9 +340,10 @@
 
 m4_include(dlfcn.m4)
 m4_include(getpass.m4)
-m4_include(system/config.m4)
-m4_include(win32/config.m4)
+m4_include(win32.m4)
 m4_include(repdir.m4)
 
+m4_include(system/config.m4)
+
 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
   [AC_MSG_ERROR([Required function not found])])

Modified: branches/SAMBA_4_0/source/lib/replace/replace.h
===
--- branches/SAMBA_4_0/source/lib/replace/replace.h 2006-09-13 10:12:55 UTC 
(rev 18457)
+++ branches/SAMBA_4_0/source/lib/replace/replace.h 2006-09-13 10:13:01 UTC 
(rev 18458)
@@ -40,7 +40,7 @@
 #include errno.h
 
 #if defined(_MSC_VER) || defined(__MINGW32__)
-#include lib/replace/win32/replace.h
+#include win32_replace.h
 #endif
 
 #ifdef __COMPAR_FN_T

Deleted: branches/SAMBA_4_0/source/lib/replace/win32/config.m4
===
--- branches/SAMBA_4_0/source/lib/replace/win32/config.m4   2006-09-13 
10:12:55 UTC (rev 18457)
+++ branches/SAMBA_4_0/source/lib/replace/win32/config.m4   2006-09-13 
10:13:01 UTC (rev 18458)
@@ -1,20 +0,0 @@
-AC_CHECK_HEADERS(direct.h windows.h winsock2.h ws2tcpip.h)
-
-###
-# Check for mkdir mode
-AC_CACHE_CHECK( [whether mkdir supports mode], ac_mkdir_has_mode,
-   AC_TRY_COMPILE([
-   #include stdio.h
-   #ifdef HAVE_DIRECT_H
-   #include direct.h
-   #endif],[
-   mkdir(foo,0777);
-   return 0;
-   ],
-ac_mkdir_has_mode=yes,
-ac_mkdir_has_mode=no) )
-
-if test $ac_mkdir_has_mode = yes
-then
-AC_DEFINE(HAVE_MKDIR_MODE, 1, [Define if target mkdir supports mode 
option])
-fi

Deleted: branches/SAMBA_4_0/source/lib/replace/win32/replace.h
===
--- branches/SAMBA_4_0/source/lib/replace/win32/replace.h   2006-09-13 
10:12:55 UTC (rev 18457)
+++ branches/SAMBA_4_0/source/lib/replace/win32/replace.h   2006-09-13 
10:13:01 UTC (rev 18458)
@@ -1,159 +0,0 @@
-#ifndef _WIN32_REPLACE_H
-#define _WIN32_REPLACE_H
-
-#ifdef HAVE_WINSOCK2_H
-#include winsock2.h
-#endif
-
-#ifdef HAVE_WS2TCPIP_H
-#include ws2tcpip.h
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#include windows.h
-#endif
-
-/* Map BSD Socket errorcodes to the WSA errorcodes (if possible) */ 
-
-#define EAFNOSUPPORT   WSAEAFNOSUPPORT
-#define ECONNREFUSEDWSAECONNREFUSED 
-#define EINPROGRESSWSAEINPROGRESS
-#define EMSGSIZE   WSAEMSGSIZE 
-#define ENOBUFS WSAENOBUFS
-#define ENOTSOCK   WSAENOTSOCK
-#define ENETUNREACHWSAENETUNREACH
-#define ENOPROTOOPTWSAENOPROTOOPT
-#define ENOTCONN   WSAENOTCONN 
-#define ENOTSUP134 
-
-/* We undefine the following constants due to conflicts with the w32api headers
- * and the Windows Platform SDK/DDK.
- */
-
-#undef interface
-
-#undef ERROR_INVALID_PARAMETER
-#undef ERROR_INSUFFICIENT_BUFFER
-#undef ERROR_INVALID_DATATYPE
-
-#undef FILE_GENERIC_READ
-#undef FILE_GENERIC_WRITE
-#undef FILE_GENERIC_EXECUTE
-#undef FILE_ATTRIBUTE_READONLY
-#undef FILE_ATTRIBUTE_HIDDEN
-#undef FILE_ATTRIBUTE_SYSTEM
-#undef FILE_ATTRIBUTE_DIRECTORY
-#undef FILE_ATTRIBUTE_ARCHIVE
-#undef FILE_ATTRIBUTE_DEVICE
-#undef FILE_ATTRIBUTE_NORMAL
-#undef FILE_ATTRIBUTE_TEMPORARY
-#undef FILE_ATTRIBUTE_REPARSE_POINT
-#undef FILE_ATTRIBUTE_COMPRESSED
-#undef FILE_ATTRIBUTE_OFFLINE
-#undef FILE_ATTRIBUTE_ENCRYPTED
-#undef FILE_FLAG_WRITE_THROUGH
-#undef FILE_FLAG_NO_BUFFERING
-#undef FILE_FLAG_RANDOM_ACCESS
-#undef FILE_FLAG_SEQUENTIAL_SCAN
-#undef FILE_FLAG_DELETE_ON_CLOSE
-#undef FILE_FLAG_BACKUP_SEMANTICS
-#undef FILE_FLAG_POSIX_SEMANTICS
-#undef FILE_TYPE_DISK
-#undef FILE_TYPE_UNKNOWN
-#undef FILE_CASE_SENSITIVE_SEARCH
-#undef FILE_CASE_PRESERVED_NAMES
-#undef FILE_UNICODE_ON_DISK
-#undef FILE_PERSISTENT_ACLS
-#undef FILE_FILE_COMPRESSION
-#undef FILE_VOLUME_QUOTAS
-#undef FILE_VOLUME_IS_COMPRESSED
-#undef FILE_NOTIFY_CHANGE_FILE_NAME
-#undef 

svn commit: samba r18459 - in branches/SAMBA_4_0/source/script/tests: .

2006-09-13 Thread abartlet
Author: abartlet
Date: 2006-09-13 10:26:32 + (Wed, 13 Sep 2006)
New Revision: 18459

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18459

Log:
Set access to test LDAP server as system to anonymous, but also note
the correct authz-regexp for future use.

Fail to test if slapd fails and TEST_LDAP=yes


Modified:
   branches/SAMBA_4_0/source/script/tests/mktestsetup.sh
   branches/SAMBA_4_0/source/script/tests/selftest.sh
   branches/SAMBA_4_0/source/script/tests/test_functions.sh


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/mktestsetup.sh
===
--- branches/SAMBA_4_0/source/script/tests/mktestsetup.sh   2006-09-13 
10:13:01 UTC (rev 18458)
+++ branches/SAMBA_4_0/source/script/tests/mktestsetup.sh   2006-09-13 
10:26:32 UTC (rev 18459)
@@ -101,6 +101,8 @@
server max protocol = SMB2
notify:inotify = false
 
+system:anonymous = true
+
 [tmp]
path = $TMPDIR
read only = no
@@ -292,13 +294,15 @@
 sasl-realm $DNSNAME
 access to * by * write
 
+allow update_anon
+
 authz-regexp
   uid=([^,]*),cn=$DNSNAME,cn=digest-md5,cn=auth
-  ldap:///$BASEDN??sub?(samAccountName=$1)
+  ldap:///$BASEDN??sub?(samAccountName=\$1)
 
 authz-regexp
   uid=([^,]*),cn=([^,]*),cn=digest-md5,cn=auth
-  ldap:///$BASEDN??sub?(samAccountName=$1)
+  ldap:///$BASEDN??sub?(samAccountName=\$1)
 
 include $LDAPDIR/modules.conf
 

Modified: branches/SAMBA_4_0/source/script/tests/selftest.sh
===
--- branches/SAMBA_4_0/source/script/tests/selftest.sh  2006-09-13 10:13:01 UTC 
(rev 18458)
+++ branches/SAMBA_4_0/source/script/tests/selftest.sh  2006-09-13 10:26:32 UTC 
(rev 18459)
@@ -63,7 +63,7 @@
 
 #Start slapd before smbd
 if [ x$TEST_LDAP = xyes ]; then
-slapd_start
+slapd_start || exit 1;
 echo -n LDAP PROVISIONING...
 $srcdir/bin/smbscript $srcdir/setup/provision $PROVISION_OPTIONS 
--ldap-backend=$LDAPI || {
echo LDAP PROVISIONING failed: $srcdir/bin/smbscript 
$srcdir/setup/provision $PROVISION_OPTIONS --ldap-backend=$LDAPI

Modified: branches/SAMBA_4_0/source/script/tests/test_functions.sh
===
--- branches/SAMBA_4_0/source/script/tests/test_functions.sh2006-09-13 
10:13:01 UTC (rev 18458)
+++ branches/SAMBA_4_0/source/script/tests/test_functions.sh2006-09-13 
10:26:32 UTC (rev 18459)
@@ -69,10 +69,12 @@
 OLDPATH=$PATH
 PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
 export PATH
-slapd -f $SLAPD_CONF -h $LDAPI_ESCAPE
+# running slapd in the background means it stays in the same process group, so 
it can be
+# killed by timelimit
+slapd -d0 -f $SLAPD_CONF -h $LDAPI_ESCAPE 
 PATH=$OLDPATH
 export PATH
-return 0;
+return $?;
 }
 
 testit() {



svn commit: samba r18460 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 10:51:26 + (Wed, 13 Sep 2006)
New Revision: 18460

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18460

Log:
split out timegm test and only add timegm.o when needed

metze
Added:
   branches/SAMBA_4_0/source/lib/replace/timegm.m4
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4
   branches/SAMBA_4_0/source/lib/replace/timegm.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 10:26:32 UTC 
(rev 18459)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 10:51:26 UTC 
(rev 18460)
@@ -11,7 +11,7 @@
 LIBREPLACEOBJ=replace.o
 AC_SUBST(LIBREPLACEOBJ)
 
-LIBREPLACEOBJ=${LIBREPLACEOBJ} snprintf.o timegm.o
+LIBREPLACEOBJ=${LIBREPLACEOBJ} snprintf.o
 
 dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable 
it
 dnl which conflicts with C99 on HPUX
@@ -279,7 +279,7 @@
 AC_CHECK_TYPE(comparison_fn_t, 
 [AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
 
-AC_CHECK_FUNCS(timegm strnlen setenv)
+AC_CHECK_FUNCS(strnlen setenv)
 AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
 
 # this test disabled as we don't actually need __VA_ARGS__ yet
@@ -338,12 +338,13 @@
AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands 
volatile])
 fi
 
+m4_include(system/config.m4)
+
 m4_include(dlfcn.m4)
 m4_include(getpass.m4)
 m4_include(win32.m4)
+m4_include(timegm.m4)
 m4_include(repdir.m4)
 
-m4_include(system/config.m4)
-
 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
   [AC_MSG_ERROR([Required function not found])])

Modified: branches/SAMBA_4_0/source/lib/replace/timegm.c
===
--- branches/SAMBA_4_0/source/lib/replace/timegm.c  2006-09-13 10:26:32 UTC 
(rev 18459)
+++ branches/SAMBA_4_0/source/lib/replace/timegm.c  2006-09-13 10:51:26 UTC 
(rev 18460)
@@ -36,18 +36,8 @@
 */
 
 #include replace.h
-#include stdlib.h
+#include system/time.h
 
-#ifndef HAVE_TIMEGM
-
-#ifdef HAVE_SYS_TIME_H
-#include sys/time.h
-#endif
-
-#ifdef HAVE_TIME_H
-#include time.h
-#endif
-
 static int is_leap(unsigned y)
 {
y += 1900;
@@ -76,5 +66,3 @@
res += tm-tm_sec;
return res;
 }
-
-#endif /* HAVE_TIMEGM */

Added: branches/SAMBA_4_0/source/lib/replace/timegm.m4
===
--- branches/SAMBA_4_0/source/lib/replace/timegm.m4 2006-09-13 10:26:32 UTC 
(rev 18459)
+++ branches/SAMBA_4_0/source/lib/replace/timegm.m4 2006-09-13 10:51:26 UTC 
(rev 18460)
@@ -0,0 +1 @@
+AC_CHECK_FUNCS(timegm,[],[LIBREPLACEOBJ=${LIBREPLACEOBJ} timegm.o])



svn commit: samba r18461 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 10:58:40 + (Wed, 13 Sep 2006)
New Revision: 18461

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18461

Log:
- extend make showflags
- let make test trigger showflags

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/Makefile.in


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/Makefile.in
===
--- branches/SAMBA_4_0/source/lib/replace/Makefile.in   2006-09-13 10:51:26 UTC 
(rev 18460)
+++ branches/SAMBA_4_0/source/lib/replace/Makefile.in   2006-09-13 10:58:40 UTC 
(rev 18461)
@@ -21,8 +21,9 @@
 
 showflags:
@echo 'libreplace will be compiled with flags:'
+   @echo '  CC = $(CC)'
@echo '  CFLAGS = $(CFLAGS)'
-   @echo '  LIBS = $(LIBS)'
+   @echo '  LIBS   = $(LIBS)'
 
 install: all
mkdir -p $(libdir)
@@ -31,7 +32,7 @@
 libreplace.a: $(OBJS)
ar -rcsv $@ $(OBJS)
 
-test: testsuite
+test: all
./testsuite
 
 installcheck: install test



svn commit: samba r18462 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 11:08:50 + (Wed, 13 Sep 2006)
New Revision: 18462

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18462

Log:
make the output a bit nicer

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir.m4
===
--- branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 10:58:40 UTC 
(rev 18461)
+++ branches/SAMBA_4_0/source/lib/replace/repdir.m4 2006-09-13 11:08:50 UTC 
(rev 18462)
@@ -51,6 +51,10 @@
libreplace_READDIR_NEEDED=no
 fi
 
+AC_MSG_CHECKING([a usable readdir()])
 if test x$libreplace_READDIR_NEEDED = xyes; then
-   AC_MSG_WARN([the provides readdir() is broken])
+   AC_MSG_RESULT(no)
+   AC_MSG_WARN([the provided readdir() is broken])
+else
+   AC_MSG_RESULT(yes)
 fi



svn commit: samba r18463 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 11:39:40 + (Wed, 13 Sep 2006)
New Revision: 18463

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18463

Log:
add some more warning flags, tested with gcc 2.95.3 on SuSE 7.3

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/configure.ac


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/configure.ac
===
--- branches/SAMBA_4_0/source/lib/replace/configure.ac  2006-09-13 11:08:50 UTC 
(rev 18462)
+++ branches/SAMBA_4_0/source/lib/replace/configure.ac  2006-09-13 11:39:40 UTC 
(rev 18463)
@@ -6,7 +6,17 @@
 m4_include(libreplace.m4)
 
 if test $ac_cv_prog_gcc = yes; then
-   CFLAGS=$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith 
-Wcast-qual -Wcast-align -Wwrite-strings
+   CFLAGS=$CFLAGS -Wall
+   CFLAGS=$CFLAGS -W
+   CFLAGS=$CFLAGS -Wshadow
+   CFLAGS=$CFLAGS -Wstrict-prototypes
+   CFLAGS=$CFLAGS -Wpointer-arith
+   CFLAGS=$CFLAGS -Wcast-qual
+   CFLAGS=$CFLAGS -Wcast-align
+   CFLAGS=$CFLAGS -Wwrite-strings
+   CFLAGS=$CFLAGS -Werror-implicit-function-declaration
+   CFLAGS=$CFLAGS -Wformat=2
+   CFLAGS=$CFLAGS -Wno-format-y2k
 fi
 
 AC_OUTPUT(Makefile)



svn commit: samba r18464 - in branches/SAMBA_3_0/source/libads: .

2006-09-13 Thread vlendec
Author: vlendec
Date: 2006-09-13 11:40:21 + (Wed, 13 Sep 2006)
New Revision: 18464

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18464

Log:
Solaris has LDAP_SCOPE_ONELEVEL. Linux seems to have it as well.

Fix a C++ compat warning.

Volker

Modified:
   branches/SAMBA_3_0/source/libads/ldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===
--- branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 11:39:40 UTC (rev 
18463)
+++ branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 11:40:21 UTC (rev 
18464)
@@ -2925,13 +2925,14 @@
ads_memfree(ads, hostnameDN);
if (rc != LDAP_SUCCESS) {
const char *attrs[] = { cn, NULL };
-   void *msg_sub;
+   LDAPMessage *msg_sub;
 
/* we only search with scope ONE, we do not expect any further
 * objects to be created deeper */
 
-   status = ads_do_search_retry(ads, hostnameDN, LDAP_SCOPE_ONE,
-   (objectclass=*), attrs, res);
+   status = ads_do_search_retry(ads, hostnameDN,
+LDAP_SCOPE_ONELEVEL,
+(objectclass=*), attrs, res);
 
if (!ADS_ERR_OK(status)) {
SAFE_FREE(host);
@@ -2963,8 +2964,9 @@
}
 
/* there should be no subordinate objects anymore */
-   status = ads_do_search_retry(ads, hostnameDN, LDAP_SCOPE_ONE,
-   (objectclass=*), attrs, res);
+   status = ads_do_search_retry(ads, hostnameDN,
+LDAP_SCOPE_ONELEVEL,
+(objectclass=*), attrs, res);
 
if (!ADS_ERR_OK(status) || ( (ads_count_replies(ads, res))  0 
) ) {
SAFE_FREE(host);



svn commit: samba r18465 - in branches/SAMBA_4_0/source: heimdal_build lib/replace

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 12:32:27 + (Wed, 13 Sep 2006)
New Revision: 18465

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18465

Log:
much better fix for a roken specifiv problem

metze
Modified:
   branches/SAMBA_4_0/source/heimdal_build/config.m4
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4


Changeset:
Modified: branches/SAMBA_4_0/source/heimdal_build/config.m4
===
--- branches/SAMBA_4_0/source/heimdal_build/config.m4   2006-09-13 11:40:21 UTC 
(rev 18464)
+++ branches/SAMBA_4_0/source/heimdal_build/config.m4   2006-09-13 12:32:27 UTC 
(rev 18465)
@@ -116,11 +116,7 @@
 AC_MSG_CHECKING(for $1)
 AC_CACHE_VAL([ac_cv_type_$cv],
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include sys/types.h
-#if STDC_HEADERS
-#include stdlib.h
-#include stddef.h
-#endif
+AC_INCLUDES_DEFAULT
 $2]],
 [[$1 foo;]])],
 [eval ac_cv_type_$cv=yes],

Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 11:40:21 UTC 
(rev 18464)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 12:32:27 UTC 
(rev 18465)
@@ -70,17 +70,6 @@
 AC_CHECK_TYPE(ssize_t, int)
 AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
 
-dnl these are needed for heimdal roken.h
-AC_CHECK_TYPE(struct sockaddr, [], [], [
-AC_INCLUDES_DEFAULT
-#include sys/socket.h])
-AC_CHECK_TYPE(struct sockaddr_storage, [], [], [
-AC_INCLUDES_DEFAULT
-#include sys/socket.h])
-AC_CHECK_TYPE(struct addrinfo, [], [], [
-AC_INCLUDES_DEFAULT
-#include netdb.h])
-
 AC_TYPE_SIGNAL
 AC_TYPE_UID_T
 AC_TYPE_MODE_T



svn commit: samba r18466 - in branches/SAMBA_3_0/source/libads: .

2006-09-13 Thread vlendec
Author: vlendec
Date: 2006-09-13 13:02:51 + (Wed, 13 Sep 2006)
New Revision: 18466

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18466

Log:
Attempt to fix the AIX build
Modified:
   branches/SAMBA_3_0/source/libads/dns.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/dns.c
===
--- branches/SAMBA_3_0/source/libads/dns.c  2006-09-13 12:32:27 UTC (rev 
18465)
+++ branches/SAMBA_3_0/source/libads/dns.c  2006-09-13 13:02:51 UTC (rev 
18466)
@@ -46,7 +46,9 @@
 #  define T_A  ns_t_a
 #endif
 #  define T_SRVns_t_srv
+#if !defined(T_NS) /* AIX 5.3 already defines T_NS */
 #  define T_NS ns_t_ns
+#endif
 #else
 #  ifdef HFIXEDSZ
 #define NS_HFIXEDSZ HFIXEDSZ



svn commit: samba r18467 - in branches/SAMBA_3_0/source/utils: .

2006-09-13 Thread jra
Author: jra
Date: 2006-09-13 13:28:42 + (Wed, 13 Sep 2006)
New Revision: 18467

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18467

Log:
Some sites allow an account to be deleted, but not
disabled. Cope with both - print appropriate messages.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/utils/net_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===
--- branches/SAMBA_3_0/source/utils/net_ads.c   2006-09-13 13:02:51 UTC (rev 
18466)
+++ branches/SAMBA_3_0/source/utils/net_ads.c   2006-09-13 13:28:42 UTC (rev 
18467)
@@ -755,10 +755,12 @@
  That only worked using the machine creds because added the machine
  with full control to the computer object's ACL.
 ***/
+
 static int net_ads_leave(int argc, const char **argv)
 {
ADS_STRUCT *ads = NULL;
ADS_STATUS adsret;
+   NTSTATUS status;
int ret = -1;
struct cli_state *cli = NULL;
TALLOC_CTX *ctx;
@@ -795,28 +797,29 @@
goto done;
}
 
-   if ( !NT_STATUS_IS_OK(netdom_leave_domain( ctx, cli, dom_sid )) ) {
-   d_fprintf(stderr, Failed to disable machine account for '%s' 
in realm '%s'\n,
-   global_myname(), ads-config.realm);
-   goto done;
-   }
-   
-   ret = 0;
+   status = netdom_leave_domain(ctx, cli, dom_sid);
 
-   /* Now we've disabled the account, try and delete it
-  via LDAP - the old way we used to. Don't log a failure
-  if this failed. */
+   /* Ty and delete it via LDAP - the old way we used to. */
 
adsret = ads_leave_realm(ads, global_myname());
if (ADS_ERR_OK(adsret)) {
d_printf(Deleted account for '%s' in realm '%s'\n,
global_myname(), ads-config.realm);
+   ret = 0;
} else {
-   d_printf(Disabled account for '%s' in realm '%s'\n,
-   global_myname(), ads-config.realm);
+   /* We couldn't delete it - see if the disable succeeded. */
+   if (NT_STATUS_IS_OK(status)) {
+   d_printf(Disabled account for '%s' in realm '%s'\n,
+   global_myname(), ads-config.realm);
+   ret = 0;
+   } else {
+   d_fprintf(stderr, Failed to disable machine account 
for '%s' in realm '%s'\n,
+   global_myname(), ads-config.realm);
+   }
}
 
 done:
+
if ( cli ) 
cli_shutdown(cli);
 



svn commit: samba r18468 - in branches/SAMBA_4_0/source/librpc/idl: .

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 13:37:52 + (Wed, 13 Sep 2006)
New Revision: 18468

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18468

Log:
Add IDL for dfs_EnumEx. Still lacks test(s)

Modified:
   branches/SAMBA_4_0/source/librpc/idl/dfs.idl


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/dfs.idl
===
--- branches/SAMBA_4_0/source/librpc/idl/dfs.idl2006-09-13 13:28:42 UTC 
(rev 18467)
+++ branches/SAMBA_4_0/source/librpc/idl/dfs.idl2006-09-13 13:37:52 UTC 
(rev 18468)
@@ -221,7 +221,13 @@
WERROR dfs_Remove2();
 
/* Function 0x15 */
-   WERROR dfs_EnumEx();
+   WERROR dfs_EnumEx(
+   [in,string,charset(UTF16)] uint16 *name,
+   [in] uint32 level,
+   [in] uint32 bufsize,
+   [in,out,unique] dfs_EnumStruct *info,
+   [in,out,unique] uint32 *total
+ );
 
/* Function 0x16 */
WERROR dfs_SetInfo2();



svn commit: samba r18469 - in branches/SAMBA_3_0/source: . include librpc/gen_ndr rpc_client rpcclient

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 13:42:23 + (Wed, 13 Sep 2006)
New Revision: 18469

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18469

Log:
Use new pidl-generated DFS client code.

Removed:
   branches/SAMBA_3_0/source/rpc_client/cli_dfs.c
Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0/source/include/rpc_client.h
   branches/SAMBA_3_0/source/librpc/gen_ndr/
   branches/SAMBA_3_0/source/librpc/gen_ndr/cli_dfs.c
   branches/SAMBA_3_0/source/librpc/gen_ndr/cli_dfs.h
   branches/SAMBA_3_0/source/librpc/gen_ndr/dfs.h
   branches/SAMBA_3_0/source/librpc/gen_ndr/ndr_dfs.c
   branches/SAMBA_3_0/source/rpcclient/cmd_dfs.c


Changeset:
Sorry, the patch is too large (1130 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18469


svn commit: samba r18470 - in branches/SAMBA_4_0/source/pidl: . lib/Parse/Pidl/Samba3

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 13:45:36 + (Wed, 13 Sep 2006)
New Revision: 18470

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18470

Log:
Remove obsolete client generator code for Samba3 (we're now using the 
new code that uses libndr)

Removed:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm
Modified:
   branches/SAMBA_4_0/source/pidl/pidl


Changeset:
Deleted: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm  
2006-09-13 13:42:23 UTC (rev 18469)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Client.pm  
2006-09-13 13:45:36 UTC (rev 18470)
@@ -1,137 +0,0 @@
-###
-# Samba3 NDR client generator for IDL structures
-# Copyright [EMAIL PROTECTED] 2005
-# released under the GNU GPL
-
-package Parse::Pidl::Samba3::Client;
-
-use strict;
-use Parse::Pidl::Typelist qw(hasType getType mapType);
-use Parse::Pidl::Util qw(has_property ParseExpr);
-use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
-use Parse::Pidl::Samba3::Types qw(DeclLong);
-
-use vars qw($VERSION);
-$VERSION = '0.01';
-
-my $res = ;
-my $tabs = ;
-sub indent() { $tabs.=\t; }
-sub deindent() { $tabs = substr($tabs, 1); }
-sub pidl($) { $res .= $tabs.(shift).\n; }
-sub fatal($$) { my ($e,$s) = @_; 
die($e-{ORIGINAL}-{FILE}:$e-{ORIGINAL}-{LINE}: $s\n); }
-sub warning($$) { my ($e,$s) = @_; 
warn($e-{ORIGINAL}-{FILE}:$e-{ORIGINAL}-{LINE}: $s\n); }
-
-sub CopyLevel()
-{
-   sub CopyLevel();
-   my ($e,$l,$argument,$member) = @_;
-
-   if ($l-{TYPE} eq DATA) {
-   pidl *$argument = $member;;
-   } elsif ($l-{TYPE} eq POINTER) {
-   pidl if (r.ptr$l-{POINTER_INDEX}_$e-{NAME}) {;
-   indent;
-   pidl *$argument = talloc_size(mem_ctx, sizeof(void *));;
-   CopyLevel($e,GetNextLevel($e,$l),*$argument, $member);
-   deindent;
-   pidl };
-   } elsif ($l-{TYPE} eq SWITCH) {
-   CopyLevel($e,GetNextLevel($e,$l),$argument,$member);
-   } elsif ($l-{TYPE} eq ARRAY) {
-   pidl *$argument = $member;;
-   }
-}
-
-sub ParseFunction($$)
-{
-   my ($if,$fn) = @_;
-
-   my $inargs = ;
-   my $defargs = ;
-   foreach (@{$fn-{ELEMENTS}}) {
-   $defargs .= ,  . DeclLong($_);
-   if (grep(/in/, @{$_-{DIRECTION}})) {
-   $inargs .= , $_-{NAME};
-   } 
-   }
-
-   my $uif = uc($if-{NAME});
-   my $ufn = uc($fn-{NAME});
-
-   pidl NTSTATUS rpccli_$fn-{NAME}(struct rpc_pipe_client *cli, 
TALLOC_CTX *mem_ctx$defargs);
-   pidl {;
-   indent;
-   pidl prs_struct qbuf, rbuf;;
-   pidl $uif\_Q_$ufn q;;
-   pidl $uif\_R_$ufn r;;
-   pidl ;
-   pidl ZERO_STRUCT(q);;
-   pidl ZERO_STRUCT(r);;
-   pidl ;
-   pidl /* Marshall data and send request */;
-   pidl ;
-   pidl if (!init_$if-{NAME}_q_$fn-{NAME}(q$inargs));
-   pidl \treturn NT_STATUS_INVALID_PARAMETER;;
-   pidl ;
-   pidl CLI_DO_RPC(cli, mem_ctx, PI_$uif, $ufn,;
-   pidl \tq, r,;
-   pidl \tqbuf, rbuf, ;
-   pidl \t$if-{NAME}_io_q_$fn-{NAME},;
-   pidl \t$if-{NAME}_io_r_$fn-{NAME},;
-   pidl \tNT_STATUS_UNSUCCESSFUL);;
-   pidl ;
-   pidl /* Return variables */;
-   foreach my $e (@{$fn-{ELEMENTS}}) {
-   next unless (grep(/out/, @{$e-{DIRECTION}}));
-
-   CopyLevel($e, $e-{LEVELS}[1], $e-{NAME}, r.$e-{NAME});
-   }
-
-   pidl;
-   pidl /* Return result */;
-   if (not $fn-{RETURN_TYPE}) {
-   pidl return NT_STATUS_OK;;
-   } elsif ($fn-{RETURN_TYPE} eq NTSTATUS) {
-   pidl return r.status;;
-   } elsif ($fn-{RETURN_TYPE} eq WERROR) {
-   pidl return werror_to_ntstatus(r.status);;
-   } else {
-   pidl /* Sorry, don't know how to convert $fn-{RETURN_TYPE} to 
NTSTATUS */;
-   pidl return NT_STATUS_OK;;
-   }
-
-   deindent;
-   pidl };
-   pidl ;
-}
-
-sub ParseInterface($)
-{
-   my $if = shift;
-
-   ParseFunction($if, $_) foreach (@{$if-{FUNCTIONS}});
-}
-
-sub Parse($$)
-{
-   my($ndr,$filename) = @_;
-
-   $res = ;
-
-   pidl /*;
-   pidl  * Unix SMB/CIFS implementation.;
-   pidl  * client auto-generated by pidl. DO NOT MODIFY!;
-   pidl  */;
-   pidl ;
-   pidl #include \includes.h\;
-   pidl ;
-   
-   foreach (@$ndr) {
-   ParseInterface($_) if ($_-{TYPE} eq INTERFACE);
-   }
-
-   return $res;
-}
-
-1;

Modified: branches/SAMBA_4_0/source/pidl/pidl
===
--- branches/SAMBA_4_0/source/pidl/pidl 2006-09-13 13:42:23 UTC (rev 18469)
+++ 

svn commit: samba r18471 - in branches/SAMBA_4_0/source/pidl: . lib/Parse/Pidl/Samba3

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 13:49:17 + (Wed, 13 Sep 2006)
New Revision: 18471

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18471

Log:
Remove other Samba3 parser generator support as well - it's no 
longer necessary as we can use libndr now.

Removed:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Header.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Parser.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Template.pm
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Types.pm
Modified:
   branches/SAMBA_4_0/source/pidl/pidl


Changeset:
Sorry, the patch is too large (1465 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18471


svn commit: samba r18472 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 13:50:51 + (Wed, 13 Sep 2006)
New Revision: 18472

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18472

Log:
- use STDC_HEADERS for stdlib.h and stddef.h as autoconf does
- AC_HEADERS_STDC is not explicit needed

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4
   branches/SAMBA_4_0/source/lib/replace/replace.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 13:49:17 UTC 
(rev 18471)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 13:50:51 UTC 
(rev 18472)
@@ -24,6 +24,7 @@
 AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_CC_C99
 AC_C_INLINE
+AC_C_BIGENDIAN
 AC_PROG_INSTALL
 
 AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
@@ -50,10 +51,6 @@
 
 AC_CHECK_HEADERS([standards.h])
 
-AC_C_BIGENDIAN
-AC_HEADER_STDC
-
-
 AC_CHECK_SIZEOF(off_t,cross)
 AC_CHECK_SIZEOF(size_t,cross)
 AC_CHECK_SIZEOF(ssize_t,cross)
@@ -86,7 +83,7 @@
 
 AC_CHECK_FUNCS(pipe strftime srandom random srand rand usleep setbuffer lstat 
getpgrp)
 
-AC_CHECK_HEADERS(stdbool.h stddef.h sys/select.h)
+AC_CHECK_HEADERS(stdbool.h sys/select.h)
 
 AC_CHECK_HEADERS(sys/epoll.h)
 AC_CHECK_FUNCS(epoll_create)

Modified: branches/SAMBA_4_0/source/lib/replace/replace.h
===
--- branches/SAMBA_4_0/source/lib/replace/replace.h 2006-09-13 13:49:17 UTC 
(rev 18471)
+++ branches/SAMBA_4_0/source/lib/replace/replace.h 2006-09-13 13:50:51 UTC 
(rev 18472)
@@ -72,7 +72,8 @@
 #include sys/types.h
 #endif
 
-#ifdef HAVE_STDDEF_H
+#if STDC_HEADERS
+#include stdlib.h
 #include stddef.h
 #endif
 



svn commit: samba r18473 - in branches/SAMBA_3_0/source: lib nsswitch

2006-09-13 Thread jra
Author: jra
Date: 2006-09-13 13:55:19 + (Wed, 13 Sep 2006)
New Revision: 18473

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18473

Log:
Once we go online, trigger a get krb5 ticket event
immediately if we were waiting on one.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/lib/events.c
   branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c


Changeset:
Modified: branches/SAMBA_3_0/source/lib/events.c
===
--- branches/SAMBA_3_0/source/lib/events.c  2006-09-13 13:50:51 UTC (rev 
18472)
+++ branches/SAMBA_3_0/source/lib/events.c  2006-09-13 13:55:19 UTC (rev 
18473)
@@ -58,7 +58,8 @@
te-handler = handler;
te-private_data = private_data;
 
-   /* keep the list ordered */
+   /* keep the list ordered - this is NOT guarenteed as event times
+  may be changed after insertion */
last_te = NULL;
for (cur_te = timed_events; cur_te; cur_te = cur_te-next) {
/* if the new event comes before the current one break */
@@ -115,3 +116,17 @@
 
return to_ret;
 }
+
+int set_event_dispatch_time(const char *event_name, struct timeval when)
+{
+   int num_events = 0;
+   struct timed_event *te;
+
+   for (te = timed_events; te; te = te-next) {
+   if (strcmp(event_name, te-event_name) == 0) {
+   te-when = when;
+   num_events++;
+   }
+   }
+   return num_events;
+}

Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c2006-09-13 13:50:51 UTC 
(rev 18472)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cm.c2006-09-13 13:55:19 UTC 
(rev 18473)
@@ -146,6 +146,8 @@
 
 void set_domain_online(struct winbindd_domain *domain)
 {
+   struct timeval now;
+
DEBUG(10,(set_domain_online: called for domain %s\n,
domain-name ));
 
@@ -155,6 +157,10 @@
return;
}
 
+   /* If we are waiting to get a krb5 ticket, trigger immediately. */
+   GetTimeOfDay(now);
+   set_event_dispatch_time(krb5_ticket_gain_handler, now);
+
domain-online = True;
 }
 



svn commit: samba r18474 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 14:10:25 + (Wed, 13 Sep 2006)
New Revision: 18474

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18474

Log:
- we don't need to explicit check stdint.h and inttypes.h
  alsready done by autoconf magic
- display the sizes of all standard C types
- check for int64_t and uint64_t

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 13:55:19 UTC 
(rev 18473)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 14:10:25 UTC 
(rev 18474)
@@ -51,20 +51,30 @@
 
 AC_CHECK_HEADERS([standards.h])
 
-AC_CHECK_SIZEOF(off_t,cross)
-AC_CHECK_SIZEOF(size_t,cross)
-AC_CHECK_SIZEOF(ssize_t,cross)
-
-AC_CHECK_HEADERS([stdint.h inttypes.h])
 AC_CHECK_TYPE(uint_t, unsigned int)
+AC_CHECK_TYPE(int8_t, char)
 AC_CHECK_TYPE(uint8_t, unsigned char)
-AC_CHECK_TYPE(int8_t, char)
 AC_CHECK_TYPE(int16_t, short)
 AC_CHECK_TYPE(uint16_t, unsigned short)
 AC_CHECK_TYPE(int32_t, long)
-AC_CHECK_TYPE(intptr_t, unsigned long long)
 AC_CHECK_TYPE(uint32_t, unsigned long)
+AC_CHECK_TYPE(int64_t, long long)
+AC_CHECK_TYPE(uint64_t, unsigned long long)
+
+AC_CHECK_TYPE(size_t, unsigned int)
 AC_CHECK_TYPE(ssize_t, int)
+
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(char)
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+
+AC_CHECK_SIZEOF(off_t)
+AC_CHECK_SIZEOF(size_t)
+AC_CHECK_SIZEOF(ssize_t)
+
+AC_CHECK_TYPE(intptr_t, unsigned long long)
 AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
 
 AC_TYPE_SIGNAL
@@ -77,7 +87,6 @@
 AC_CHECK_TYPE(ino_t,unsigned)
 AC_CHECK_TYPE(loff_t,off_t)
 AC_CHECK_TYPE(offset_t,loff_t)
-AC_CHECK_TYPES(long long)
 
 AC_FUNC_MEMCMP
 



svn commit: samba r18475 - in branches/SAMBA_4_0/source/pidl: . lib/Parse/Pidl/Samba3

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 14:13:48 + (Wed, 13 Sep 2006)
New Revision: 18475

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18475

Log:
Start working on server code generator that uses libndr.

Added:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
Removed:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Server.pm
Modified:
   branches/SAMBA_4_0/source/pidl/pidl


Changeset:
Deleted: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Server.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Server.pm  
2006-09-13 14:10:25 UTC (rev 18474)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/Server.pm  
2006-09-13 14:13:48 UTC (rev 18475)
@@ -1,122 +0,0 @@
-###
-# Samba3 NDR server generator for IDL structures
-# Copyright [EMAIL PROTECTED] 2005
-# released under the GNU GPL
-
-package Parse::Pidl::Samba3::Server;
-
-use strict;
-use Parse::Pidl::Typelist qw(hasType getType mapType);
-use Parse::Pidl::Util qw(has_property ParseExpr);
-use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
-
-my $res = ;
-my $tabs = ;
-
-sub indent() { $tabs.=\t; }
-sub deindent() { $tabs = substr($tabs, 1); }
-sub pidl($) { $res .= $tabs.(shift).\n; }
-
-use vars qw($VERSION);
-$VERSION = '0.01';
-
-sub ParseFunction($$)
-{
-   my ($if,$fn) = @_;
-
-   pidl 
/**;
-   pidl  api_$fn-{NAME};
-   pidl  
*/;
-   pidl ;
-   pidl static BOOL api_$fn-{NAME}(pipes_struct *p);
-   pidl {;
-   indent;
-   pidl uc($if-{NAME}_q_$fn-{NAME}) .  q_u;;
-   pidl uc($if-{NAME}_r_$fn-{NAME}) .  r_u;;
-   pidl prs_struct *data = p-in_data.data;;
-   pidl prs_struct *rdata = p-out_data.rdata;;
-   pidl ;
-   pidl ZERO_STRUCT(q_u);;
-   pidl ZERO_STRUCT(r_u);;
-   pidl ;
-   pidl if (!$if-{NAME}_io_q_$fn-{NAME}(\\, q_u, data, 0));
-   pidl \treturn False;;
-   pidl ;
-   if ($fn-{RETURN_TYPE}) {
-   pidl r_u.status = _$fn-{NAME}(p, q_u, r_u);;
-   } else {
-   pidl _$fn-{NAME}(p, q_u, r_u);;
-   }
-   pidl ;
-   pidl if (!$if-{NAME}_io_r_$fn-{NAME}(\\, r_u, rdata, 0));
-   pidl \treturn False;;
-   pidl ;
-   pidl return True;;
-   deindent;
-   pidl };
-}
-
-sub ParseInterface($)
-{
-   my $if = shift;
-
-   ParseFunction($if, $_) foreach (@{$if-{FUNCTIONS}});
-   
-   pidl ;
-   pidl /* Tables */;
-   pidl static struct api_struct api_$if-{NAME}_cmds[] = ;
-   pidl {;
-   indent;
-   foreach (@{$if-{FUNCTIONS}}) {
-   pidl {\ . uc($_-{NAME}) . \,  . uc($_-{NAME}) . , 
api_$_-{NAME}},;
-   }
-   deindent;
-   pidl };;
-
-   pidl ;
-   
-   pidl void $if-{NAME}_get_pipe_fns(struct api_struct **fns, int 
*n_fns);
-   pidl {;
-   indent;
-   pidl *fns = api_$if-{NAME}_cmds;;
-   pidl *n_fns = sizeof(api_$if-{NAME}_cmds) / sizeof(struct 
api_struct);;
-   deindent;
-   pidl };
-
-   pidl ;
-
-   pidl NTSTATUS rpc_$if-{NAME}_init(void);
-   pidl {;
-   indent;
-   pidl return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, 
\$if-{NAME}\, \$if-{NAME}\, api_$if-{NAME}_cmds, 
sizeof(api_$if-{NAME}_cmds) / sizeof(struct api_struct));;
-   deindent;
-   pidl };
-}
-
-sub Parse($$)
-{
-   my($ndr,$filename) = @_;
-
-   $tabs = ;
-   $res = ;
-
-   pidl /*;
-   pidl  * Unix SMB/CIFS implementation.;
-   pidl  * server auto-generated by pidl. DO NOT MODIFY!;
-   pidl  */;
-   pidl ;
-   pidl #include \includes.h\;
-   pidl #include \nterr.h\;
-   pidl ;
-   pidl #undef DBGC_CLASS;
-   pidl #define DBGC_CLASS DBGC_RPC;
-   pidl ;
-
-   foreach (@$ndr) {
-   ParseInterface($_) if ($_-{TYPE} eq INTERFACE);
-   }
-
-   return $res;
-}
-
-1;

Added: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 14:10:25 UTC (rev 18474)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 14:13:48 UTC (rev 18475)
@@ -0,0 +1,110 @@
+###
+# Samba3 server generator for IDL structures
+# on top of Samba4 style NDR functions
+# Copyright [EMAIL PROTECTED] 2005-2006
+# released under the GNU GPL
+
+package Parse::Pidl::Samba3::ServerNDR;
+
+use strict;
+use Parse::Pidl::Typelist qw(hasType getType mapType scalar_is_reference);
+use Parse::Pidl::Util qw(has_property ParseExpr is_constant);
+use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel 

svn commit: samba r18476 - in branches/SAMBA_3_0/source/nsswitch: .

2006-09-13 Thread jra
Author: jra
Date: 2006-09-13 14:54:55 + (Wed, 13 Sep 2006)
New Revision: 18476

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18476

Log:
Protect ourselves from bad cached creds a little
better - don't just panic - delete them.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c
===
--- branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-09-13 14:13:48 UTC 
(rev 18475)
+++ branches/SAMBA_3_0/source/nsswitch/winbindd_cache.c 2006-09-13 14:54:55 UTC 
(rev 18476)
@@ -282,13 +282,13 @@
if (len != 16) {
DEBUG(0,(centry corruption? hash len (%u) != 16\n, 
len ));
-   smb_panic(centry_hash16);
+   return NULL;
}
 
if (centry-len - centry-ofs  16) {
DEBUG(0,(centry corruption? needed 16 bytes, have %d\n, 
 centry-len - centry-ofs));
-   smb_panic(centry_hash16);
+   return NULL;
}
 
ret = TALLOC_ARRAY(mem_ctx, char, 16);
@@ -589,6 +589,24 @@
return centry;
 }
 
+static void wcache_delete(const char *format, ...) PRINTF_ATTRIBUTE(1,2);
+static void wcache_delete(const char *format, ...)
+{
+   va_list ap;
+   char *kstr;
+   TDB_DATA key;
+
+   va_start(ap, format);
+   smb_xvasprintf(kstr, format, ap);
+   va_end(ap);
+
+   key.dptr = kstr;
+   key.dsize = strlen(kstr);
+
+   tdb_delete(wcache-tdb, key);
+   free(kstr);
+}
+
 /*
   make sure we have at least len bytes available in a centry 
 */
@@ -918,7 +936,17 @@
   if we are returning a salted cred. */
 
*cached_nt_pass = (const uint8 *)centry_hash16(centry, mem_ctx);
+   if (*cached_nt_pass == NULL) {
+   const char *sidstr = sid_string_static(sid);
 
+   /* Bad (old) cred cache. Delete and pretend we
+  don't have it. */
+   DEBUG(0,(wcache_get_creds: bad entry for [CRED/%s] - 
deleting\n, 
+   sidstr));
+   wcache_delete(CRED/%s, sidstr);
+   return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+   }
+
/* We only have 17 bytes more data in the salted cred case. */
if (centry-len - centry-ofs == 17) {
*cached_salt = (const uint8 *)centry_hash16(centry, mem_ctx);



Re: svn commit: samba r18449 - in branches/SAMBA_3_0/source: . lib

2006-09-13 Thread tridge
  Attempt to fix the build on non-linux platforms: Many of those don't have
  strtoull. This is a copy of the stuff in samba4 libreplace, which is GPL. I
  hope it is ok to copypaste it into a GPL file. Tridge, we could also create 
  a
  replace_lpgl.c if needed.

it's fine to copy that over. The only one that was a problem was
timegm.c, and only because we need to retain its separate file header
(giving credit to heimdal).

Cheers, Tridge


svn commit: samba r18477 - in branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3: .

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 15:45:20 + (Wed, 13 Sep 2006)
New Revision: 18477

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18477

Log:
Finish server code generator for Samba 3.

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 14:54:55 UTC (rev 18476)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 15:45:20 UTC (rev 18477)
@@ -33,7 +33,75 @@
pidl static BOOL api_$fn-{NAME}(pipes_struct *p);
pidl {;
indent;
+   pidl struct ndr_pull *pull;;
+   pidl struct ndr_push *push;;
+   pidl DATA_BLOB blob;;
+   pidl struct $fn-{NAME} r;;
+   pidl TALLOC_CTX *mem_ctx = talloc_init(\api_$fn-{NAME}\);;
+   pidl ;
+   pidl if (!prs_data_blob(p-in_data.data, blob, mem_ctx)) {;
+   pidl \ttalloc_free(mem_ctx);;
+   pidl \treturn False;;
+   pidl };
+   pidl ;
+   pidl pull = ndr_pull_init_blob(blob, mem_ctx);;
+   pidl if (pull == NULL);
+   pidl \treturn False;;
+   pidl ;
+   pidl pull-flags |= LIBNDR_FLAG_REF_ALLOC;;
+   pidl status = ndr_pull_$fn-{NAME}(pull, NDR_IN, r);;
+   pidl if (NT_STATUS_IS_ERR(status)) {;
+   pidl \ttalloc_free(mem_ctx);;
+   pidl \treturn False;;
+   pidl };
+   pidl ;
+   my $proto = _$fn-{NAME}(pipes_struct *p;
+   my $ret = _$fn-{NAME}(p;
+   foreach (@{$fn-{ELEMENTS}}) {
+   my @dir = @{$_-{DIRECTION}};
+   if (grep(@dir, /in/) and grep(@dir, /out/)) {
+   pidl r.out.$_-{NAME} = r.in.$_-{NAME};;
+   }
+   if (grep(@dir, /in/)) { $ret .= , r.in.$_-{NAME}; }
+   else { $ret .= , r.out.$_-{NAME}; }
 
+   $proto .= ,  . DeclLong($_);
+   }
+   $ret .= );
+   $proto .= );;
+
+   if ($fn-{RETURN_TYPE}) {
+   $ret = r.out.result = $ret;
+   $proto = $fn-{RETURN_TYPE} $proto;
+   } else {
+   $proto = void $proto;
+   }
+
+   pidl_hdr $proto;
+   pidl $ret;;
+
+   pidl ;
+   pidl push = ndr_push_init_ctx(mem_ctx);;
+   pidl if (push == NULL) {;
+   pidl \ttalloc_free(mem_ctx);;
+   pidl \treturn False;;
+   pidl };
+   pidl ;
+   pidl status = ndr_push_$fn-{NAME}(push, NDR_OUT, r);;
+   pidl if (NT_STATUS_IS_ERR(status)) {;
+   pidl \ttalloc_free(mem_ctx);;
+   pidl \treturn False;;
+   pidl };
+   pidl ;
+   pidl blob = ndr_push_blob(push);;
+   pidl if (!prs_init_data_blob(p-in_data.rdata, blob, p-mem_ctx)) {;
+   pidl \ttalloc_free(mem_ctx);;
+   pidl \treturn False;;
+   pidl };
+   pidl ;
+   pidl talloc_free(mem_ctx);;
+   pidl ;
+   pidl return True;;
deindent;
pidl };
pidl ;



svn commit: samba r18478 - in branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3: .

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 15:54:08 + (Wed, 13 Sep 2006)
New Revision: 18478

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18478

Log:
Add missing declaration for status.

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 15:45:20 UTC (rev 18477)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 15:54:08 UTC (rev 18478)
@@ -35,6 +35,7 @@
indent;
pidl struct ndr_pull *pull;;
pidl struct ndr_push *push;;
+   pidl NTSTATUS status;;
pidl DATA_BLOB blob;;
pidl struct $fn-{NAME} r;;
pidl TALLOC_CTX *mem_ctx = talloc_init(\api_$fn-{NAME}\);;



svn commit: samba r18479 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 16:15:38 + (Wed, 13 Sep 2006)
New Revision: 18479

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18479

Log:
start hiding libreplace configure tests behind macros

AC_LIBREPLACE_CC_CHECKS
AC_LIBREPLACE_BROKEN_CHECKS
and 
AC_LIBREPLACE_ALL_CHECKS 
which calls the 2 others

I'll add some more, so that samba3/samba4 can later call
them in the wanted order and all standalone builds
use AC_LIBREPLACE_ALL_CHECKS.

metze
Added:
   branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4
   branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 15:54:08 UTC 
(rev 18478)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4 2006-09-13 16:15:38 UTC 
(rev 18479)
@@ -1,3 +1,7 @@
+AC_DEFUN_ONCE(AC_LIBREPLACE_BROKEN_CHECKS,
+[
+echo LIBREPLACE_BROKEN_CHECKS: START
+
 dnl find the libreplace sources. This is meant to work both for 
 dnl libreplace standalone builds, and builds of packages using libreplace
 libreplacedir=
@@ -13,70 +17,6 @@
 
 LIBREPLACEOBJ=${LIBREPLACEOBJ} snprintf.o
 
-dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable 
it
-dnl which conflicts with C99 on HPUX
-ac_cv_prog_cc_Ae=no
-
-savedCFLAGS=$CFLAGS
-AC_PROG_CC
-CFLAGS=$savedCFLAGS
-AC_ISC_POSIX
-AC_USE_SYSTEM_EXTENSIONS
-AC_PROG_CC_C99
-AC_C_INLINE
-AC_C_BIGENDIAN
-AC_PROG_INSTALL
-
-AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
-[/* Enable XOPEN extensions on systems that have them.  */
-#ifndef _XOPEN_SOURCE_EXTENDED
-# define _XOPEN_SOURCE_EXTENDED 1
-#endif])
-
-AH_VERBATIM([_OSF_SOURCE],
-[/* Enable OSF extensions on systems that have them.  */
-#ifndef _OSF_SOURCE
-# define _OSF_SOURCE 1
-#endif])
-
-LIBREPLACE_C99_STRUCT_INIT([],[])
-
-AC_SYS_LARGEFILE
-
-dnl Add #include for broken IRIX header files
-case $host_os in
-   *irix6*) AC_ADD_INCLUDE(standards.h)
-   ;;
-esac
-
-AC_CHECK_HEADERS([standards.h])
-
-AC_CHECK_TYPE(uint_t, unsigned int)
-AC_CHECK_TYPE(int8_t, char)
-AC_CHECK_TYPE(uint8_t, unsigned char)
-AC_CHECK_TYPE(int16_t, short)
-AC_CHECK_TYPE(uint16_t, unsigned short)
-AC_CHECK_TYPE(int32_t, long)
-AC_CHECK_TYPE(uint32_t, unsigned long)
-AC_CHECK_TYPE(int64_t, long long)
-AC_CHECK_TYPE(uint64_t, unsigned long long)
-
-AC_CHECK_TYPE(size_t, unsigned int)
-AC_CHECK_TYPE(ssize_t, int)
-
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(char)
-AC_CHECK_SIZEOF(short)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-
-AC_CHECK_SIZEOF(off_t)
-AC_CHECK_SIZEOF(size_t)
-AC_CHECK_SIZEOF(ssize_t)
-
-AC_CHECK_TYPE(intptr_t, unsigned long long)
-AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
-
 AC_TYPE_SIGNAL
 AC_TYPE_UID_T
 AC_TYPE_MODE_T
@@ -343,3 +283,24 @@
 
 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
   [AC_MSG_ERROR([Required function not found])])
+
+echo LIBREPLACE_BROKEN_CHECKS: END
+]) dnl end AC_LIBREPLACE_BROKEN_CHECKS
+
+AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_START,
+[
+#LIBREPLACE_ALL_CHECKS: START
+])
+AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_END,
+[
+#LIBREPLACE_ALL_CHECKS: END
+])
+m4_define(AC_LIBREPLACE_ALL_CHECKS,
+[
+AC__LIBREPLACE_ALL_CHECKS_START
+AC_LIBREPLACE_CC_CHECKS
+AC_LIBREPLACE_BROKEN_CHECKS
+AC__LIBREPLACE_ALL_CHECKS_END
+])
+
+AC_LIBREPLACE_ALL_CHECKS

Added: branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4  2006-09-13 
15:54:08 UTC (rev 18478)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4  2006-09-13 
16:15:38 UTC (rev 18479)
@@ -0,0 +1,99 @@
+
+AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_START,
+[
+echo LIBREPLACE_CC_CHECKS: START
+])
+
+AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_END,
+[
+echo LIBREPLACE_CC_CHECKS: END
+])
+
+dnl
+dnl
+dnl AC_LIBREPLACE_CC_CHECKS
+dnl
+dnl Note: we need to use m4_define instead of AC_DEFUN because
+dnl   of the ordering of tests
+dnl   
+dnl 
+m4_define(AC_LIBREPLACE_CC_CHECKS,
+[
+AC__LIBREPLACE_ONLY_CC_CHECKS_START
+
+dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable 
it
+dnl which conflicts with C99 on HPUX
+ac_cv_prog_cc_Ae=no
+
+savedCFLAGS=$CFLAGS
+AC_PROG_CC
+CFLAGS=$savedCFLAGS
+dnl AC_PROG_CPP
+dnl AC_PROG_EGREP
+dnl AC_GNU_SOURCE
+dnl AC_AIX
+dnl AC_MINIX
+dnl AC_GNU_SOURCE
+dnl AC_INCLUDES_DEFAULT
+dnl AC_USE_SYSTEM_EXTENSIONS
+dnl AC_INCLUDES_DEFAULT
+dnl AC_HEADER_STDC
+AC_ISC_POSIX
+AC_USE_SYSTEM_EXTENSIONS
+AC_PROG_CC_C99
+AC_C_INLINE
+AC_C_BIGENDIAN
+AC_PROG_INSTALL
+
+AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
+[/* Enable XOPEN extensions on systems that have them.  */
+#ifndef _XOPEN_SOURCE_EXTENDED
+# define _XOPEN_SOURCE_EXTENDED 1
+#endif])
+

svn commit: samba r18480 - in branches/SAMBA_3_0/source/libads: .

2006-09-13 Thread jra
Author: jra
Date: 2006-09-13 16:21:48 + (Wed, 13 Sep 2006)
New Revision: 18480

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18480

Log:
Doh ! Double-free of hostnameDN.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libads/ldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===
--- branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 16:15:38 UTC (rev 
18479)
+++ branches/SAMBA_3_0/source/libads/ldap.c 2006-09-13 16:21:48 UTC (rev 
18480)
@@ -2922,7 +2922,6 @@
DEBUG(3,(ldap_delete_ext_s succeeded with error code %d\n, 
rc));
}
 
-   ads_memfree(ads, hostnameDN);
if (rc != LDAP_SUCCESS) {
const char *attrs[] = { cn, NULL };
LDAPMessage *msg_sub;



svn commit: samba r18481 - in branches/SAMBA_3_0/source: . include librpc/gen_ndr rpc_parse rpc_server script smbd

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 16:28:25 + (Wed, 13 Sep 2006)
New Revision: 18481

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18481

Log:
Use pidl-generated server side code for dfs.

Added:
   branches/SAMBA_3_0/source/librpc/gen_ndr/srv_dfs.c
   branches/SAMBA_3_0/source/librpc/gen_ndr/srv_dfs.h
   branches/SAMBA_3_0/source/librpc/gen_ndr/srv_lsa.c
   branches/SAMBA_3_0/source/librpc/gen_ndr/srv_lsa.h
   branches/SAMBA_3_0/source/librpc/gen_ndr/srv_unixinfo.c
   branches/SAMBA_3_0/source/librpc/gen_ndr/srv_unixinfo.h
Removed:
   branches/SAMBA_3_0/source/include/rpc_dfs.h
   branches/SAMBA_3_0/source/rpc_parse/parse_dfs.c
   branches/SAMBA_3_0/source/rpc_server/srv_dfs.c
Modified:
   branches/SAMBA_3_0/source/Makefile.in
   branches/SAMBA_3_0/source/include/includes.h
   branches/SAMBA_3_0/source/rpc_server/srv_dfs_nt.c
   branches/SAMBA_3_0/source/script/build_idl.sh
   branches/SAMBA_3_0/source/smbd/msdfs.c


Changeset:
Sorry, the patch is too large (10211 lines) to include; please use WebSVN to 
see it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18481


svn commit: samba r18482 - in branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3: .

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 16:29:14 + (Wed, 13 Sep 2006)
New Revision: 18482

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18482

Log:
Fix a couple of small issues in the generated server code.

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
===
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 16:28:25 UTC (rev 18481)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm   
2006-09-13 16:29:14 UTC (rev 18482)
@@ -60,10 +60,10 @@
my $ret = _$fn-{NAME}(p;
foreach (@{$fn-{ELEMENTS}}) {
my @dir = @{$_-{DIRECTION}};
-   if (grep(@dir, /in/) and grep(@dir, /out/)) {
+   if (grep(/in/, @dir) and grep(/out/, @dir)) {
pidl r.out.$_-{NAME} = r.in.$_-{NAME};;
}
-   if (grep(@dir, /in/)) { $ret .= , r.in.$_-{NAME}; }
+   if (grep(/in/, @dir)) { $ret .= , r.in.$_-{NAME}; }
else { $ret .= , r.out.$_-{NAME}; }
 
$proto .= ,  . DeclLong($_);
@@ -95,7 +95,7 @@
pidl };
pidl ;
pidl blob = ndr_push_blob(push);;
-   pidl if (!prs_init_data_blob(p-in_data.rdata, blob, p-mem_ctx)) {;
+   pidl if (!prs_init_data_blob(p-out_data.rdata, blob, p-mem_ctx)) 
{;
pidl \ttalloc_free(mem_ctx);;
pidl \treturn False;;
pidl };



svn commit: samba r18483 - in branches: SAMBA_3_0/source/passdb SAMBA_3_0_23/source/passdb

2006-09-13 Thread jra
Author: jra
Date: 2006-09-13 16:30:40 + (Wed, 13 Sep 2006)
New Revision: 18483

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18483

Log:
Ensure all pdb_XXX calls are wrapped in become_root()/unbecome_root()
pairs. Should fix bug #4097.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/passdb/lookup_sid.c
   branches/SAMBA_3_0_23/source/passdb/lookup_sid.c


Changeset:
Modified: branches/SAMBA_3_0/source/passdb/lookup_sid.c
===
--- branches/SAMBA_3_0/source/passdb/lookup_sid.c   2006-09-13 16:29:14 UTC 
(rev 18482)
+++ branches/SAMBA_3_0/source/passdb/lookup_sid.c   2006-09-13 16:30:40 UTC 
(rev 18483)
@@ -1117,6 +1117,7 @@
 {
uid_t low, high;
uint32 rid;
+   BOOL ret;
 
ZERO_STRUCTP(psid);
 
@@ -1131,7 +1132,11 @@
goto done;
}
 
-   if (pdb_uid_to_rid(uid, rid)) {
+   become_root();
+   ret = pdb_uid_to_rid(uid, rid);
+   unbecome_root();
+
+   if (ret) {
/* This is a mapped user */
sid_copy(psid, get_global_sam_sid());
sid_append_rid(psid, rid);
@@ -1156,6 +1161,7 @@
 
 void gid_to_sid(DOM_SID *psid, gid_t gid)
 {
+   BOOL ret;
gid_t low, high;
 
ZERO_STRUCTP(psid);
@@ -1171,7 +1177,11 @@
goto done;
}
 
-   if (pdb_gid_to_sid(gid, psid)) {
+   become_root();
+   ret = pdb_gid_to_sid(gid, psid);
+   unbecome_root();
+
+   if (ret) {
/* This is a mapped group */
goto done;
}
@@ -1213,8 +1223,13 @@
 
if (sid_peek_check_rid(get_global_sam_sid(), psid, rid)) {
union unid_t id;
+   BOOL ret;
 
-   if (pdb_sid_to_id(psid, id, type)) {
+   become_root();
+   ret = pdb_sid_to_id(psid, id, type);
+   unbecome_root();
+
+   if (ret) {
if (type != SID_NAME_USER) {
DEBUG(5, (sid %s is a %s, expected a user\n,
  sid_string_static(psid),
@@ -1288,7 +1303,13 @@
 
if ((sid_check_is_in_builtin(psid) ||
 sid_check_is_in_wellknown_domain(psid))) {
-   if (pdb_getgrsid(map, *psid)) {
+   BOOL ret;
+
+   become_root();
+   ret = pdb_getgrsid(map, *psid);
+   unbecome_root();
+
+   if (ret) {
*pgid = map.gid;
goto done;
}
@@ -1296,7 +1317,13 @@
}
 
if (sid_peek_check_rid(get_global_sam_sid(), psid, rid)) {
-   if (pdb_sid_to_id(psid, id, type)) {
+   BOOL ret;
+
+   become_root();
+   ret = pdb_sid_to_id(psid, id, type);
+   unbecome_root();
+
+   if (ret) {
if ((type != SID_NAME_DOM_GRP) 
(type != SID_NAME_ALIAS)) {
DEBUG(5, (sid %s is a %s, expected a group\n,

Modified: branches/SAMBA_3_0_23/source/passdb/lookup_sid.c
===
--- branches/SAMBA_3_0_23/source/passdb/lookup_sid.c2006-09-13 16:29:14 UTC 
(rev 18482)
+++ branches/SAMBA_3_0_23/source/passdb/lookup_sid.c2006-09-13 16:30:40 UTC 
(rev 18483)
@@ -1069,6 +1069,7 @@
 {
uid_t low, high;
uint32 rid;
+   BOOL ret;
 
ZERO_STRUCTP(psid);
 
@@ -1083,7 +1084,11 @@
goto done;
}
 
-   if (pdb_uid_to_rid(uid, rid)) {
+   become_root();
+   ret = pdb_uid_to_rid(uid, rid);
+   unbecome_root();
+
+   if (ret) {
/* This is a mapped user */
sid_copy(psid, get_global_sam_sid());
sid_append_rid(psid, rid);
@@ -1108,6 +1113,7 @@
 
 void gid_to_sid(DOM_SID *psid, gid_t gid)
 {
+   BOOL ret;
gid_t low, high;
 
ZERO_STRUCTP(psid);
@@ -1123,7 +1129,11 @@
goto done;
}
 
-   if (pdb_gid_to_sid(gid, psid)) {
+   become_root();
+   ret = pdb_gid_to_sid(gid, psid);
+   unbecome_root();
+
+   if (ret) {
/* This is a mapped group */
goto done;
}
@@ -1165,8 +1175,13 @@
 
if (sid_peek_check_rid(get_global_sam_sid(), psid, rid)) {
union unid_t id;
+   BOOL ret;
 
-   if (pdb_sid_to_id(psid, id, type)) {
+   become_root();
+   ret = pdb_sid_to_id(psid, id, type);
+   unbecome_root();
+
+   if (ret) {
if (type != SID_NAME_USER) {
DEBUG(5, (sid %s is a %s, expected a user\n,
  sid_string_static(psid),
@@ -1240,7 +1255,13 @@
 
if ((sid_check_is_in_builtin(psid) ||
 

svn commit: samba r18484 - in branches/SAMBA_3_0/source: . nsswitch

2006-09-13 Thread gd
Author: gd
Date: 2006-09-13 16:39:52 + (Wed, 13 Sep 2006)
New Revision: 18484

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18484

Log:
Start some cleanup on pam_winbind's syslogging: 

* as openlog() is non-reentrant and pam_winbind thereby overrides the
  syslog settings of the calling application, directly call syslog (or
  pam_vsyslog if available)

* support the PAM_SILENT flag to avoid any log messages beeing created

Guenther

Modified:
   branches/SAMBA_3_0/source/configure.in
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.c
   branches/SAMBA_3_0/source/nsswitch/pam_winbind.h


Changeset:
Sorry, the patch is too large (824 lines) to include; please use WebSVN to see 
it!
WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18484


Re: svn commit: samba r18481 - in branches/SAMBA_3_0/source: . include librpc/gen_ndr rpc_parse rpc_server script smbd

2006-09-13 Thread Stefan (metze) Metzmacher
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[EMAIL PROTECTED] schrieb:
 Author: jelmer
 Date: 2006-09-13 16:28:25 + (Wed, 13 Sep 2006)
 New Revision: 18481
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18481
 
 Log:
 Use pidl-generated server side code for dfs.

Hi Jelmer,

that looks really nice!

you just need some error checks on talloc_asprintf()

metze
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFFCDaJm70gjA5TCD8RAgSpAJ0Znqk4b3UMBPzPyyaoa/xfVZspuQCeLHuA
kZn5tSANhKD7SFv4da7UAtE=
=zg16
-END PGP SIGNATURE-


svn commit: samba r18485 - in branches/SAMBA_4_0/source: . build/m4 lib/ldb lib/replace lib/talloc lib/tdb

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 16:51:45 + (Wed, 13 Sep 2006)
New Revision: 18485

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18485

Log:
include libreplace.m4 in the aclocal.m4 files
and use the macros in configure.ac

metze
Modified:
   branches/SAMBA_4_0/source/aclocal.m4
   branches/SAMBA_4_0/source/build/m4/check_cc.m4
   branches/SAMBA_4_0/source/configure.ac
   branches/SAMBA_4_0/source/lib/ldb/aclocal.m4
   branches/SAMBA_4_0/source/lib/ldb/configure.ac
   branches/SAMBA_4_0/source/lib/replace/aclocal.m4
   branches/SAMBA_4_0/source/lib/replace/configure.ac
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4
   branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4
   branches/SAMBA_4_0/source/lib/replace/samba.m4
   branches/SAMBA_4_0/source/lib/talloc/aclocal.m4
   branches/SAMBA_4_0/source/lib/talloc/configure.ac
   branches/SAMBA_4_0/source/lib/tdb/aclocal.m4
   branches/SAMBA_4_0/source/lib/tdb/configure.ac


Changeset:
Modified: branches/SAMBA_4_0/source/aclocal.m4
===
--- branches/SAMBA_4_0/source/aclocal.m42006-09-13 16:39:52 UTC (rev 
18484)
+++ branches/SAMBA_4_0/source/aclocal.m42006-09-13 16:51:45 UTC (rev 
18485)
@@ -34,7 +34,7 @@
   $1=[$]ac_new_flags
 ])
 
-m4_include(lib/replace/libreplace_macros.m4)
+m4_include(lib/replace/libreplace.m4)
 m4_include(build/m4/ax_cflags_gcc_option.m4)
 m4_include(build/m4/ax_cflags_irix_option.m4)
 m4_include(build/m4/public.m4)

Modified: branches/SAMBA_4_0/source/build/m4/check_cc.m4
===
--- branches/SAMBA_4_0/source/build/m4/check_cc.m4  2006-09-13 16:39:52 UTC 
(rev 18484)
+++ branches/SAMBA_4_0/source/build/m4/check_cc.m4  2006-09-13 16:51:45 UTC 
(rev 18485)
@@ -5,14 +5,7 @@
 dnl ---
 dnl
 
-# don't let the AC_PROG_CC macro auto set the CFLAGS
-OLD_CFLAGS=${CFLAGS}
-AC_PROG_CC
-CFLAGS=${OLD_CFLAGS}
-if test x$CC = x; then
-   AC_MSG_WARN([No c compiler was not found!])
-   AC_MSG_ERROR([Please Install gcc from http://gcc.gnu.org/])
-fi
+AC_LIBREPLACE_CC_CHECKS
 
 if test x$GCC = xyes ; then
AC_MSG_CHECKING([for version of gcc])
@@ -29,9 +22,6 @@
CFLAGS=${CFLAGS} -g
 fi
 
-dnl needed before AC_TRY_COMPILE
-AC_ISC_POSIX
-
 
 # check if the compiler handles c99 struct initialization
 LIBREPLACE_C99_STRUCT_INIT(samba_cv_c99_struct_initialization=yes,

Modified: branches/SAMBA_4_0/source/configure.ac
===
--- branches/SAMBA_4_0/source/configure.ac  2006-09-13 16:39:52 UTC (rev 
18484)
+++ branches/SAMBA_4_0/source/configure.ac  2006-09-13 16:51:45 UTC (rev 
18485)
@@ -11,8 +11,8 @@
 AC_DEFINE(CONFIG_H_IS_FROM_SAMBA,1,[Marker for samba's config.h])
 
 # Configuration rules.
+m4_include(build/m4/env.m4)
 m4_include(lib/replace/samba.m4)
-m4_include(build/m4/env.m4)
 m4_include(lib/smbreadline/readline.m4)
 m4_include(heimdal_build/config.m4)
 m4_include(lib/util/fault.m4)

Modified: branches/SAMBA_4_0/source/lib/ldb/aclocal.m4
===
--- branches/SAMBA_4_0/source/lib/ldb/aclocal.m42006-09-13 16:39:52 UTC 
(rev 18484)
+++ branches/SAMBA_4_0/source/lib/ldb/aclocal.m42006-09-13 16:51:45 UTC 
(rev 18485)
@@ -1 +1 @@
-m4_include(libreplace_macros.m4)
+m4_include(libreplace.m4)

Modified: branches/SAMBA_4_0/source/lib/ldb/configure.ac
===
--- branches/SAMBA_4_0/source/lib/ldb/configure.ac  2006-09-13 16:39:52 UTC 
(rev 18484)
+++ branches/SAMBA_4_0/source/lib/ldb/configure.ac  2006-09-13 16:51:45 UTC 
(rev 18485)
@@ -13,8 +13,9 @@
 AC_DEFUN([SMB_ENABLE], [echo -n ])
 AC_INIT(include/ldb.h)
 AC_CONFIG_SRCDIR([common/ldb.c])
-m4_include(libreplace.m4)
 
+AC_LIBREPLACE_ALL_CHECKS
+
 if test $ac_cv_prog_gcc = yes; then
CFLAGS=$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith 
-Wcast-qual -Wcast-align -Wwrite-strings
 fi

Modified: branches/SAMBA_4_0/source/lib/replace/aclocal.m4
===
--- branches/SAMBA_4_0/source/lib/replace/aclocal.m42006-09-13 16:39:52 UTC 
(rev 18484)
+++ branches/SAMBA_4_0/source/lib/replace/aclocal.m42006-09-13 16:51:45 UTC 
(rev 18485)
@@ -1 +1 @@
-m4_include(libreplace_macros.m4)
+m4_include(libreplace.m4)

Modified: branches/SAMBA_4_0/source/lib/replace/configure.ac
===
--- branches/SAMBA_4_0/source/lib/replace/configure.ac  2006-09-13 16:39:52 UTC 
(rev 18484)
+++ branches/SAMBA_4_0/source/lib/replace/configure.ac  2006-09-13 16:51:45 UTC 
(rev 18485)
@@ -3,7 +3,7 @@
 AC_CONFIG_SRCDIR([replace.c])
 AC_CONFIG_HEADER(config.h)
 
-m4_include(libreplace.m4)

Re: svn commit: samba r18446 - in branches/SAMBA_3_0/source: libads utils

2006-09-13 Thread Guenther Deschner
On Wed, Sep 13, 2006 at 09:03:43AM +, [EMAIL PROTECTED] wrote:
 Author: jra
 Date: 2006-09-13 09:03:42 + (Wed, 13 Sep 2006)
 New Revision: 18446
 
 WebSVN: 
 http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18446
 
 Log:
 Add the ldap 'leave domain' code - call this as
 a non-fatal error path if the 'disable machine
 account' code succeeded.

Jeremy, 

maybe we should point out that the ads_leave_realm() code here is not the
original one from earlier Samba3 but a version I modified to walk down the
hostname dn to delete all subordinate objetcs (published printers, etc.)
in the case that the caller has no permissions to use the
LDAP_SERVER_TREE_DELETE_OID control. It turned out that this is the only
way to get rid of an old workstation account in a migration scenario.

Guenther

-- 
Günther DeschnerGPG-ID: 8EE11688
Novell / SUSE Labs[EMAIL PROTECTED]
Samba Team  [EMAIL PROTECTED]


pgp2YiUl4ddmi.pgp
Description: PGP signature


svn commit: samba-docs r987 - in trunk/manpages-3: .

2006-09-13 Thread gd
Author: gd
Date: 2006-09-13 17:08:53 + (Wed, 13 Sep 2006)
New Revision: 987

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=samba-docsrev=987

Log:
Mention the silent option.

Guenther

Modified:
   trunk/manpages-3/pam_winbind.7.xml


Changeset:
Modified: trunk/manpages-3/pam_winbind.7.xml
===
--- trunk/manpages-3/pam_winbind.7.xml  2006-08-30 18:26:32 UTC (rev 986)
+++ trunk/manpages-3/pam_winbind.7.xml  2006-09-13 17:08:53 UTC (rev 987)
@@ -119,6 +119,13 @@
/para/listitem
/varlistentry
 
+   varlistentry
+   termsilent/term
+   listitempara
+   Do not emit any messages.
+   /para/listitem
+   /varlistentry
+
/variablelist
 
 



svn commit: samba r18486 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-13 17:38:49 + (Wed, 13 Sep 2006)
New Revision: 18486

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18486

Log:
hopefully this fixes the panics on solaris

metze
Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4  2006-09-13 
16:51:45 UTC (rev 18485)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4  2006-09-13 
17:38:49 UTC (rev 18486)
@@ -69,6 +69,9 @@
 
 AC_CHECK_HEADERS([standards.h])
 
+# Solaris needs HAVE_LONG_LONG defined
+AC_CHECK_TYPES(long long)
+
 AC_CHECK_TYPE(uint_t, unsigned int)
 AC_CHECK_TYPE(int8_t, char)
 AC_CHECK_TYPE(uint8_t, unsigned char)



svn commit: samba r18487 - in branches/SAMBA_3_0/source/rpc_server: .

2006-09-13 Thread jelmer
Author: jelmer
Date: 2006-09-13 17:39:21 + (Wed, 13 Sep 2006)
New Revision: 18487

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18487

Log:
Add NULL checks

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_dfs_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_dfs_nt.c
===
--- branches/SAMBA_3_0/source/rpc_server/srv_dfs_nt.c   2006-09-13 17:38:49 UTC 
(rev 18486)
+++ branches/SAMBA_3_0/source/rpc_server/srv_dfs_nt.c   2006-09-13 17:39:21 UTC 
(rev 18487)
@@ -170,6 +170,9 @@
dfs1-path = talloc_asprintf(mem_ctx, 
%s\\%s\\%s, global_myname(), 
j-service_name, j-volume_name);
+   if (dfs1-path == NULL)
+   return False;
+
DEBUG(5,(init_reply_dfs_info_1: initing entrypath: %s\n,dfs1-path));
return True;
 }
@@ -178,6 +181,8 @@
 {
dfs2-path = talloc_asprintf(mem_ctx, 
%s\\%s\\%s, global_myname(), j-service_name, 
j-volume_name);
+   if (dfs2-path == NULL)
+   return False;
dfs2-comment = talloc_strdup(mem_ctx, j-comment);
dfs2-state = 1; /* set up state of dfs junction as OK */
dfs2-num_stores = j-referral_count;
@@ -194,6 +199,9 @@
dfs3-path = talloc_asprintf(mem_ctx, %s\\%s\\%s, 
global_myname(),
j-service_name, j-volume_name);
 
+   if (dfs3-path == NULL)
+   return False;
+
dfs3-comment = talloc_strdup(mem_ctx, j-comment);
dfs3-state = 1;
dfs3-num_stores = j-referral_count;



svn commit: samba r18488 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-13 22:31:25 + (Wed, 13 Sep 2006)
New Revision: 18488

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18488

Log:

we have to make sure any extensions flags also make it into
confdefs.h, otherwise the real build and the configure tests will not
be significant

this change fixes the build of libreplace on hpux with gcc

Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4
   branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4  2006-09-13 
17:39:21 UTC (rev 18487)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace_cc.m4  2006-09-13 
22:31:25 UTC (rev 18488)
@@ -45,17 +45,9 @@
 AC_C_BIGENDIAN
 AC_PROG_INSTALL
 
-AH_VERBATIM([_XOPEN_SOURCE_EXTENDED],
-[/* Enable XOPEN extensions on systems that have them.  */
-#ifndef _XOPEN_SOURCE_EXTENDED
-# define _XOPEN_SOURCE_EXTENDED 1
-#endif])
 
-AH_VERBATIM([_OSF_SOURCE],
-[/* Enable OSF extensions on systems that have them.  */
-#ifndef _OSF_SOURCE
-# define _OSF_SOURCE 1
-#endif])
+AC_EXTENSION_FLAG(_XOPEN_SOURCE_EXTENDED)
+AC_EXTENSION_FLAG(_OSF_SOURCE)
 
 LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_WARN([c99 structure initializer are not 
supported])])
 

Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4  2006-09-13 
17:39:21 UTC (rev 18487)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4  2006-09-13 
22:31:25 UTC (rev 18488)
@@ -87,6 +87,19 @@
 rm -f conftest*
 ])])
 
+AC_DEFUN([AC_EXTENSION_FLAG],
+[
+  cat confdefs.h \EOF
+#ifndef $1
+# define $1
+#endif
+EOF
+AH_VERBATIM([$1], [#ifndef $1
+# define $1
+#endif])
+])
+
+
 dnl see if a declaration exists for a function or variable
 dnl defines HAVE_function_DECL if it exists
 dnl AC_HAVE_DECL(var, includes)



svn commit: samba r18489 - in branches/SAMBA_4_0/source: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-13 22:42:23 + (Wed, 13 Sep 2006)
New Revision: 18489

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18489

Log:

dlopen is so amazingly broken on linux

supress the valgrind warnings

Modified:
   branches/SAMBA_4_0/source/.valgrind_suppressions


Changeset:
Modified: branches/SAMBA_4_0/source/.valgrind_suppressions
===
--- branches/SAMBA_4_0/source/.valgrind_suppressions2006-09-13 22:31:25 UTC 
(rev 18488)
+++ branches/SAMBA_4_0/source/.valgrind_suppressions2006-09-13 22:42:23 UTC 
(rev 18489)
@@ -1,2 +1,53 @@
 # add valgrind suppressions for the build farm here. Get the format
 # from the build farm log
+
+{
+   samba_dlopen1
+   Memcheck:Cond
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+}
+
+{
+   samba_dlopen2
+   Memcheck:Cond
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+}
+
+{
+   samba_dlopen3
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+}
+
+{
+   samba_dlopen4
+   Memcheck:Cond
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+ }
+
+{
+   samba_dlopen5
+   Memcheck:Addr4
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+}



svn commit: samba r18490 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-13 23:13:32 + (Wed, 13 Sep 2006)
New Revision: 18490

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18490

Log:

on irix _XOPEN_SOURCE_EXTENDED needs to be defined to 1, not just
defined

Modified:
   branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4
===
--- branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4  2006-09-13 
22:42:23 UTC (rev 18489)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace_macros.m4  2006-09-13 
23:13:32 UTC (rev 18490)
@@ -91,11 +91,11 @@
 [
   cat confdefs.h \EOF
 #ifndef $1
-# define $1
+# define $1 1
 #endif
 EOF
 AH_VERBATIM([$1], [#ifndef $1
-# define $1
+# define $1 1
 #endif])
 ])
 



svn commit: samba r18491 - in branches/SAMBA_4_0/source/lib/replace/test: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-13 23:13:44 + (Wed, 13 Sep 2006)
New Revision: 18491

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18491

Log:

fixed a warning

Modified:
   branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c
===
--- branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-09-13 
23:13:32 UTC (rev 18490)
+++ branches/SAMBA_4_0/source/lib/replace/test/os2_delete.c 2006-09-13 
23:13:44 UTC (rev 18491)
@@ -34,7 +34,7 @@
mkdir(TESTDIR, 0700) == 0 || FAILED(mkdir);
 }
 
-static void create_files()
+static void create_files(void)
 {
int i;
for (i=0;iNUM_FILES;i++) {



Build status as of Thu Sep 14 00:00:02 2006

2006-09-13 Thread build
URL: http://build.samba.org/

--- /home/build/master/cache/broken_results.txt.old 2006-09-13 
00:00:19.0 +
+++ /home/build/master/cache/broken_results.txt 2006-09-14 00:00:23.0 
+
@@ -1,21 +1,21 @@
-Build status as of Wed Sep 13 00:00:01 2006
+Build status as of Thu Sep 14 00:00:02 2006
 
 Build counts:
 Tree Total  Broken Panic 
 SOC  0  0  0 
 build_farm   0  0  0 
-ccache   41 8  0 
-distcc   42 7  0 
-ldb  39 8  0 
-libreplace   38 3  0 
-lorikeet-heimdal 2  1  0 
+ccache   43 8  0 
+distcc   43 7  0 
+ldb  41 8  0 
+libreplace   39 7  0 
+lorikeet-heimdal 4  0  0 
 ppp  19 0  0 
-rsync39 5  0 
+rsync41 5  0 
 samba0  0  0 
 samba-docs   0  0  0 
-samba4   43 18 2 
-samba_3_044 25 0 
-smb-build31 4  0 
-talloc   42 4  0 
-tdb  41 6  0 
+samba4   45 16 2 
+samba_3_045 25 0 
+smb-build32 4  0 
+talloc   43 3  0 
+tdb  41 7  0 
 


svn commit: samba r18492 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-14 02:25:57 + (Thu, 14 Sep 2006)
New Revision: 18492

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18492

Log:

an attempt at replacing readdir() with something based on
getdirentries()

This is untested on any of the platforms that matter, so we'll just
have to see if the build farm machines like it

Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
===
--- branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-13 23:13:44 UTC (rev 18491)
+++ branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-14 02:25:57 UTC (rev 18492)
@@ -1 +1,157 @@
-#error the readdir() replacement using getdirentried() isn't implemented yet
+/* 
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Andrew Tridgell 2005
+
+ ** NOTE! The following LGPL license applies to the replace
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+   
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/*
+  a replacement for opendir/readdir/telldir/seekdir/closedir for BSD
+  systems using getdirentries
+
+  This is needed because the existing directory handling in FreeBSD
+  and OpenBSD (and possibly NetBSD) doesn't correctly handle unlink()
+  on files in a directory where telldir() has been used. On a block
+  boundary it will occasionally miss a file when seekdir() is used to
+  return to a position previously recorded with telldir().
+
+  This also fixes a severe performance and memory usage problem with
+  telldir() on BSD systems. Each call to telldir() in BSD adds an
+  entry to a linked list, and those entries are cleaned up on
+  closedir(). This means with a large directory closedir() can take an
+  arbitrary amount of time, causing network timeouts as millions of
+  telldir() entries are freed
+
+  Note! This replacement code is not portable. It relies on
+  getdirentries() always leaving the file descriptor at a seek offset
+  that is a multiple of DIR_BUF_SIZE. If the code detects that this
+  doesn't happen then it will abort(). It also does not handle
+  directories with offsets larger than can be stored in a long,
+
+  This code is available under other free software licenses as
+  well. Contact the author.
+*/
+
+#include stdlib.h
+#include sys/stat.h
+#include unistd.h
+#include sys/types.h
+#include errno.h
+#include fcntl.h
+#include dirent.h
+
+#define DIR_BUF_BITS 9
+#define DIR_BUF_SIZE (1DIR_BUF_BITS)
+
+struct dir_buf {
+   int fd;
+   int nbytes, ofs;
+   off_t seekpos;
+   char buf[DIR_BUF_SIZE];
+};
+
+DIR *opendir(const char *dname)
+{
+   struct dir_buf *d;
+   d = malloc(sizeof(*d));
+   if (d == NULL) {
+   errno = ENOMEM;
+   return NULL;
+   }
+   d-fd = open(dname, O_RDONLY);
+   if (d-fd == -1) {
+   free(d);
+   return NULL;
+   }
+   d-ofs = 0;
+   d-seekpos = 0;
+   d-nbytes = 0;
+   return (DIR *)d;
+}
+
+struct dirent *readdir(DIR *dir)
+{
+   struct dir_buf *d = (struct dir_buf *)dir;
+   struct dirent *de;
+
+   if (d-ofs = d-nbytes) {
+   d-nbytes = getdirentries(d-fd, d-buf, DIR_BUF_SIZE, 
d-seekpos);
+   d-ofs = 0;
+   }
+   if (d-ofs = d-nbytes) {
+   return NULL;
+   }
+   de = (struct dirent *)d-buf[d-ofs];
+   d-ofs += de-d_reclen;
+   return de;
+}
+
+long telldir(DIR *dir)
+{
+   struct dir_buf *d = (struct dir_buf *)dir;
+   if (d-ofs = d-nbytes) {
+   d-seekpos = lseek(d-fd, 0, SEEK_CUR);
+   d-ofs = 0;
+   d-nbytes = 0;
+   }
+   /* this relies on seekpos always being a multiple of
+  DIR_BUF_SIZE. Is that always true on BSD systems? */
+   if (d-seekpos  (DIR_BUF_SIZE-1)) {
+   abort();
+   }
+   return d-seekpos + d-ofs;
+}
+
+void seekdir(DIR *dir, long ofs)
+{
+   struct dir_buf *d = (struct dir_buf *)dir;
+   d-seekpos = lseek(d-fd, ofs  ~(DIR_BUF_SIZE-1), SEEK_SET);
+   d-nbytes = getdirentries(d-fd, d-buf, 

svn commit: samba r18493 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-14 02:37:00 + (Thu, 14 Sep 2006)
New Revision: 18493

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18493

Log:

another blind coding attempt at a getdirentries() based readdir()
replacement

Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
===
--- branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-14 02:25:57 UTC (rev 18492)
+++ branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-14 02:37:00 UTC (rev 18493)
@@ -91,7 +91,9 @@
struct dirent *de;
 
if (d-ofs = d-nbytes) {
-   d-nbytes = getdirentries(d-fd, d-buf, DIR_BUF_SIZE, 
d-seekpos);
+   long pos;
+   d-nbytes = getdirentries(d-fd, d-buf, DIR_BUF_SIZE, pos);
+   d-seekpos = pos;
d-ofs = 0;
}
if (d-ofs = d-nbytes) {
@@ -121,8 +123,9 @@
 void seekdir(DIR *dir, long ofs)
 {
struct dir_buf *d = (struct dir_buf *)dir;
+   long pos;
d-seekpos = lseek(d-fd, ofs  ~(DIR_BUF_SIZE-1), SEEK_SET);
-   d-nbytes = getdirentries(d-fd, d-buf, DIR_BUF_SIZE, d-seekpos);
+   d-nbytes = getdirentries(d-fd, d-buf, DIR_BUF_SIZE, pos);
d-ofs = 0;
while (d-ofs  (ofs  (DIR_BUF_SIZE-1))) {
if (readdir(dir) == NULL) break;



svn commit: samba r18494 - in branches/SAMBA_4_0/source/script/tests: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-14 03:13:02 + (Thu, 14 Sep 2006)
New Revision: 18494

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18494

Log:

don't count 'DWARF2 CFI reader' messages as valgrind failures

Modified:
   branches/SAMBA_4_0/source/script/tests/selftest.sh


Changeset:
Modified: branches/SAMBA_4_0/source/script/tests/selftest.sh
===
--- branches/SAMBA_4_0/source/script/tests/selftest.sh  2006-09-14 02:37:00 UTC 
(rev 18493)
+++ branches/SAMBA_4_0/source/script/tests/selftest.sh  2006-09-14 03:13:02 UTC 
(rev 18494)
@@ -129,7 +129,7 @@
 count=`find $PREFIX -name 'valgrind.log*' | wc -l`
 if [ $count != 0 ]; then
 for f in $PREFIX/valgrind.log*; do
-   if [ -s $f ]; then
+   if [ -s $f ]  grep -v DWARF2.CFI.reader $f  /dev/null; then
echo VALGRIND FAILURE;
failed=`expr $failed + 1`
cat $f



svn commit: samba r18495 - in branches/SAMBA_4_0/source: dsdb/samdb/ldb_modules lib/ldb/modules

2006-09-13 Thread abartlet
Author: abartlet
Date: 2006-09-14 03:15:30 + (Thu, 14 Sep 2006)
New Revision: 18495

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18495

Log:
More work on the LDAP backend (which now passes a lot of our tests!)

This adds a list of attributes that are in our wildcard seaches, but
the remote server requires to be explicitly listed.  This also cleans
up the handling of wildcards in ldb_map to be more consistant.

Also fix the partitions module to rebase the search, if on the GC
port, we do a subtree search.  (Otherwise backends can rightly
complain that the search is not in their scope).

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/samba3sam.c
   branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map.c
   branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map.h
   branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map_outbound.c
   branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map_private.h


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c
===
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c
2006-09-14 03:13:02 UTC (rev 18494)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c
2006-09-14 03:15:30 UTC (rev 18495)
@@ -303,6 +303,15 @@
}
 };
 
+/* These things do not show up in wildcard searches in OpenLDAP, but
+ * we need them to show up in the AD-like view */
+const char * const wildcard_attributes[] = {
+   objectGUID, 
+   whenCreated, 
+   whenChanged,
+   NULL
+};
+
 static struct ldb_dn *find_schema_dn(struct ldb_context *ldb, TALLOC_CTX 
*mem_ctx) 
 {
const char *rootdse_attrs[] = {schemaNamingContext, NULL};
@@ -372,7 +381,7 @@
struct entryUUID_private *entryUUID_private;
struct ldb_dn *schema_dn;
 
-   ret = ldb_map_init(module, entryUUID_attributes, NULL, NULL);
+   ret = ldb_map_init(module, entryUUID_attributes, NULL, 
wildcard_attributes, NULL);
 if (ret != LDB_SUCCESS)
 return ret;
 
@@ -387,7 +396,8 @@
return LDB_SUCCESS;
}

-   ret = fetch_objectclass_schema(module-ldb, schema_dn, 
entryUUID_private, entryUUID_private-objectclass_res);
+   ret = fetch_objectclass_schema(module-ldb, schema_dn, 
entryUUID_private, 
+  entryUUID_private-objectclass_res);
if (ret != LDB_SUCCESS) {
ldb_asprintf_errstring(module-ldb, Failed to fetch 
objectClass schema elements: %s\n, ldb_errstring(module-ldb));
return ret;

Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
===
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
2006-09-14 03:13:02 UTC (rev 18494)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/partition.c
2006-09-14 03:15:30 UTC (rev 18495)
@@ -186,35 +186,43 @@
 }
 
 
-static int partition_send_request(struct partition_context *ac, struct 
ldb_module *partition)
+static int partition_send_request(struct partition_context *ac, struct 
ldb_module *partition, 
+ struct ldb_dn *partition_base_dn)
 {
int ret;
struct ldb_module *next = make_module_for_next_request(ac-module, 
ac-module-ldb, partition);
-   
+   struct ldb_request *req;
ac-down_req = talloc_realloc(ac, ac-down_req, 
struct ldb_request *, ac-num_requests 
+ 1);
if (!ac-down_req) {
ldb_set_errstring(ac-module-ldb, Out of Memory);
return LDB_ERR_OPERATIONS_ERROR;
}
-   ac-down_req[ac-num_requests] = talloc(ac, struct ldb_request);
-   if (ac-down_req[ac-num_requests] == NULL) {
+   req = ac-down_req[ac-num_requests] = talloc(ac, struct ldb_request);
+   if (req == NULL) {
ldb_set_errstring(ac-module-ldb, Out of Memory);
return LDB_ERR_OPERATIONS_ERROR;
}

*ac-down_req[ac-num_requests] = *ac-orig_req; /* copy the request */
-   
-   if (ac-down_req[ac-num_requests]-operation == LDB_SEARCH) {
-   ac-down_req[ac-num_requests]-callback = 
partition_search_callback;
-   ac-down_req[ac-num_requests]-context = ac;
+
+   if (req-operation == LDB_SEARCH) {
+   /* If the search is for 'more' than this partition,
+* then change the basedn, so a remote LDAP server
+* doesn't object */
+   if (ldb_dn_compare_base(ac-module-ldb, 
+   partition_base_dn, req-op.search.base) 
!= 0) {
+   req-op.search.base = partition_base_dn;
+   }
+   

svn commit: samba r18496 - in branches/SAMBA_4_0/source: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-14 03:17:11 + (Thu, 14 Sep 2006)
New Revision: 18496

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18496

Log:

yet another dlopen valgrind suppression

Modified:
   branches/SAMBA_4_0/source/.valgrind_suppressions


Changeset:
Modified: branches/SAMBA_4_0/source/.valgrind_suppressions
===
--- branches/SAMBA_4_0/source/.valgrind_suppressions2006-09-14 03:15:30 UTC 
(rev 18495)
+++ branches/SAMBA_4_0/source/.valgrind_suppressions2006-09-14 03:17:11 UTC 
(rev 18496)
@@ -51,3 +51,14 @@
obj:/lib/ld-2.3.6.so
fun:_dl_open
 }
+
+{
+   samba_dlopen6
+   Memcheck:Cond
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   obj:/lib/tls/libc-2.3.6.so
+   obj:/lib/ld-2.3.6.so
+   fun:_dl_open
+}



svn commit: samba r18497 - in branches/SAMBA_4_0/source/torture/local: .

2006-09-13 Thread tridge
Author: tridge
Date: 2006-09-14 03:23:52 + (Thu, 14 Sep 2006)
New Revision: 18497

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18497

Log:

fixed crash bug in irpc test - the torture_tcase_add_test() call
is passed a stack pointer from values[], which is not valid when the
torture suite is run.

Jelmer, need to be careful when converting test code not to use stack
values from the torture_XXX() call in the test suite

Modified:
   branches/SAMBA_4_0/source/torture/local/irpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/local/irpc.c
===
--- branches/SAMBA_4_0/source/torture/local/irpc.c  2006-09-14 03:17:11 UTC 
(rev 18496)
+++ branches/SAMBA_4_0/source/torture/local/irpc.c  2006-09-14 03:23:52 UTC 
(rev 18497)
@@ -242,8 +242,8 @@
struct torture_suite *suite = torture_suite_create(mem_ctx, 
LOCAL-IRPC);
struct torture_tcase *tcase = torture_suite_add_tcase(suite, irpc);
int i;
-   uint32_t values[] = {0, 0x7FFE, 0xFFFE, 0x, 
-random()  0x};
+   static uint32_t values[] = {0, 0x7FFE, 0xFFFE, 0x, 
+   random()  0x};
 
tcase-setup = irpc_setup;
 



svn commit: samba r18498 - in branches/SAMBA_4_0/source/torture/local: .

2006-09-13 Thread abartlet
Author: abartlet
Date: 2006-09-14 05:13:20 + (Thu, 14 Sep 2006)
New Revision: 18498

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18498

Log:
While passing stack values into torture_tcase_add_test is bad, values
assigned into a static initialiser must be constant.

Wishing sweet dreams on the jet-lagged tridge :-)

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/torture/local/irpc.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/local/irpc.c
===
--- branches/SAMBA_4_0/source/torture/local/irpc.c  2006-09-14 03:23:52 UTC 
(rev 18497)
+++ branches/SAMBA_4_0/source/torture/local/irpc.c  2006-09-14 05:13:20 UTC 
(rev 18498)
@@ -242,12 +242,17 @@
struct torture_suite *suite = torture_suite_create(mem_ctx, 
LOCAL-IRPC);
struct torture_tcase *tcase = torture_suite_add_tcase(suite, irpc);
int i;
-   static uint32_t values[] = {0, 0x7FFE, 0xFFFE, 0x, 
-   random()  0x};
+   uint32_t *values = talloc_array(tcase, uint32_t, 5);
 
+   values[0] = 0;
+   values[1] = 0x7FFE;
+   values[2] = 0xFFFE;
+   values[3] = 0x;
+   values[4] = random()  0x;
+
tcase-setup = irpc_setup;
 
-   for (i = 0; i  ARRAY_SIZE(values); i++) {
+   for (i = 0; i  5; i++) {
torture_tcase_add_test(tcase, addone, test_addone, (void 
*)values[i]);
}
   



svn commit: samba r18499 - in branches/SAMBA_4_0/source/lib/replace: .

2006-09-13 Thread metze
Author: metze
Date: 2006-09-14 05:33:54 + (Thu, 14 Sep 2006)
New Revision: 18499

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=revroot=sambarev=18499

Log:
this hopefully lets the code compile on OpenBSD

the prototype was fixed in this revision
http://www.openbsd.org/cgi-bin/cvsweb/src/include/dirent.h.diff?r1=1.15r2=1.16

so we'll need a configure test to find the prototype of
telldir later

metze

Modified:
   branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
===
--- branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-14 05:13:20 UTC (rev 18498)
+++ branches/SAMBA_4_0/source/lib/replace/repdir_getdirentries.c
2006-09-14 05:33:54 UTC (rev 18499)
@@ -104,7 +104,13 @@
return de;
 }
 
+#define TELLDIR_TAKES_CONST_DIR
+
+#ifdef TELLDIR_TAKES_CONST_DIR
+long telldir(const DIR *dir)
+#else
 long telldir(DIR *dir)
+#endif
 {
struct dir_buf *d = (struct dir_buf *)dir;
if (d-ofs = d-nbytes) {