Author: vlendec Date: 2006-06-09 22:41:26 +0000 (Fri, 09 Jun 2006) New Revision: 16132
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16132 Log: My friday-night check in :-) Enable the build farm hacks and the appropriate RPC tests. I'll shut down my machine now and look at the build farm break stampede tomorrow.... No, this is not yet for 3_0, we don't have the SystemLibraryDTC fix in there yet. Volker Modified: trunk/source/configure.in trunk/source/lib/system.c trunk/source/passdb/pdb_interface.c trunk/source/script/tests/selftest.sh trunk/source/script/tests/test_posix_s3.sh Changeset: Modified: trunk/source/configure.in =================================================================== --- trunk/source/configure.in 2006-06-09 22:06:01 UTC (rev 16131) +++ trunk/source/configure.in 2006-06-09 22:41:26 UTC (rev 16132) @@ -5564,6 +5564,17 @@ fi ################################################# +# If run from the build farm, enable NASTY hacks +################################################# +AC_MSG_CHECKING(whether to enable build farm hacks) +if test x"$RUN_FROM_BUILD_FARM" = x"yes"; then + AC_MSG_RESULT(yes) + AC_DEFINE(ENABLE_BUILD_FARM_HACKS, 1, [Defined if running in the build farm]) +else + AC_MSG_RESULT(no) +fi + +################################################# # Display summary of libraries detected AC_MSG_RESULT([Using libraries:]) Modified: trunk/source/lib/system.c =================================================================== --- trunk/source/lib/system.c 2006-06-09 22:06:01 UTC (rev 16131) +++ trunk/source/lib/system.c 2006-06-09 22:41:26 UTC (rev 16132) @@ -922,16 +922,94 @@ Wrappers for getpwnam(), getpwuid(), getgrnam(), getgrgid() ****************************************************************************/ +#ifdef ENABLE_BUILD_FARM_HACKS + +/* + * In the build farm we want to be able to join machines to the domain. As we + * don't have root access, we need to bypass direct access to /etc/passwd + * after a user has been created via samr. Fake those users. + */ + +static struct passwd *fake_pwd; +static int num_fake_pwd; + struct passwd *sys_getpwnam(const char *name) { + int i; + + for (i=0; i<num_fake_pwd; i++) { + if (strcmp(fake_pwd[i].pw_name, name) == 0) { + DEBUG(10, ("Returning fake user %s\n", name)); + return &fake_pwd[i]; + } + } + return getpwnam(name); } struct passwd *sys_getpwuid(uid_t uid) { + int i; + + for (i=0; i<num_fake_pwd; i++) { + if (fake_pwd[i].pw_uid == uid) { + DEBUG(10, ("Returning fake user %s\n", + fake_pwd[i].pw_name)); + return &fake_pwd[i]; + } + } + return getpwuid(uid); } +void faked_create_user(const char *name) +{ + int i; + uid_t uid; + struct passwd new_pwd; + + for (i=0; i<10; i++) { + generate_random_buffer((unsigned char *)&uid, + sizeof(uid)); + if (getpwuid(uid) == NULL) { + break; + } + } + + if (i==10) { + /* Weird. No free uid found... */ + return; + } + + new_pwd.pw_name = SMB_STRDUP(name); + new_pwd.pw_passwd = SMB_STRDUP("x"); + new_pwd.pw_uid = uid; + new_pwd.pw_gid = 100; + new_pwd.pw_gecos = SMB_STRDUP("faked user"); + new_pwd.pw_dir = SMB_STRDUP("/nodir"); + new_pwd.pw_shell = SMB_STRDUP("/bin/false"); + + ADD_TO_ARRAY(NULL, struct passwd, new_pwd, &fake_pwd, + &num_fake_pwd); + + DEBUG(10, ("Added fake user %s, have %d fake users\n", + name, num_fake_pwd)); +} + +#else + +struct passwd *sys_getpwnam(const char *name) +{ + return getpwnam(name); +} + +struct passwd *sys_getpwuid(uid_t uid) +{ + return getpwuid(uid); +} + +#endif + struct group *sys_getgrnam(const char *name) { return getgrnam(name); Modified: trunk/source/passdb/pdb_interface.c =================================================================== --- trunk/source/passdb/pdb_interface.c 2006-06-09 22:06:01 UTC (rev 16131) +++ trunk/source/passdb/pdb_interface.c 2006-06-09 22:41:26 UTC (rev 16132) @@ -371,6 +371,15 @@ add_ret = smbrun(add_script,NULL); DEBUG(add_ret ? 0 : 3, ("_samr_create_user: Running the command `%s' gave %d\n", add_script, add_ret)); + +#ifdef ENABLE_BUILD_FARM_HACKS + if (add_ret != 0) { + DEBUG(1, ("Creating a faked user %s for build farm " + "purposes", name)); + faked_create_user(name); + } +#endif + flush_pwnam_cache(); pwd = Get_Pwnam_alloc(tmp_ctx, name); Modified: trunk/source/script/tests/selftest.sh =================================================================== --- trunk/source/script/tests/selftest.sh 2006-06-09 22:06:01 UTC (rev 16131) +++ trunk/source/script/tests/selftest.sh 2006-06-09 22:41:26 UTC (rev 16132) @@ -111,6 +111,10 @@ bind interfaces only = yes include = $COMMONCONFFILE + ; Necessary to add the build farm hacks + add user script = /bin/false + add machine script = /bin/false + kernel oplocks = no [tmp] Modified: trunk/source/script/tests/test_posix_s3.sh =================================================================== --- trunk/source/script/tests/test_posix_s3.sh 2006-06-09 22:06:01 UTC (rev 16131) +++ trunk/source/script/tests/test_posix_s3.sh 2006-06-09 22:41:26 UTC (rev 16132) @@ -32,7 +32,7 @@ raw="$raw RAW-QFILEINFO RAW-QFSINFO RAW-READ RAW-RENAME RAW-SEARCH RAW-SEEK" raw="$raw RAW-SFILEINFO RAW-SFILEINFO-BUG RAW-STREAMS RAW-UNLINK RAW-WRITE" -rpc="RPC-AUTHCONTEXT" +rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY" tests="$base $raw $rpc"
