getpass.c fails to compile because <stdio.h> is never included configure:18993: checking whether getpass should be replaced configure:19029: gcc -c -I/usr/include -L/usr/lib -L/lib -g -D_SAMBA_BUILD_=3 -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -I./lib/replace/ conftest.c >&5 In file included from conftest.c:161: ./lib/replace/getpass.c: In function `catch_signal': ./lib/replace/getpass.c:138: warning: `return' with a value, in function returning void ./lib/replace/getpass.c: In function `getsmbpass': ./lib/replace/getpass.c:144: error: `FILE' undeclared (first use in this function) ./lib/replace/getpass.c:144: error: (Each undeclared identifier is reported only once ./lib/replace/getpass.c:144: error: for each function it appears in.) ./lib/replace/getpass.c:144: error: `in' undeclared (first use in this function) ./lib/replace/getpass.c:144: error: `out' undeclared (first use in this function) ./lib/replace/getpass.c:159: error: `stdin' undeclared (first use in this function) ./lib/replace/getpass.c:160: error: `stderr' undeclared (first use in this function) ./lib/replace/getpass.c:165: error: `_IONBF' undeclared (first use in this function) .... | #include "confdefs.h" | #define _LIBREPLACE_REPLACE_H <--- this is preventing the replace.h from loading | #define REPLACE_GETPASS 1 | #define main dont_declare_main | #include "./lib/replace/getpass.c" | #undef main | | int | main () | { | | ; | return 0; | } there are 2 possible fixes, 1) remove #define _LIBREPLACE_REPLACE_H from getpass section of the configure script 2) #include <stdio.h> in lib/replace/getpass.c I compiled the latter and it worked, but the first would be the best solution I think, I'm not sure of the implications.
nm, I lied It won't compile now. I get a compiler error Compiling lib/iconv.c lib/iconv.c: In function `sys_iconv': lib/iconv.c:141: warning: passing arg 2 of `libiconv' from incompatible pointer type Compiling nsswitch/wb_client.c Compiling nsswitch/wb_common.c In file included from lib/replace/system/filesys.h:25, from nsswitch/winbind_nss_config.h:40, from nsswitch/winbind_client.h:1, from nsswitch/wb_common.c:27: /usr/include/unistd.h:330: error: parse error before '(' token The following command failed: gcc -I. -I/home/me/samba-3.0.25b/source -I/usr/local/include -g -D_SAMBA_BUILD_=3 -I/home/me/samba-3.0.25b/source/iniparse/src -Iinclude -I./include -I. -I. -I./lib/replace -I./lib/talloc -I./tdb/include -I./libaddns -I./librpc -DHAVE_CONFIG_H I/usr/local/include -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DLDAP_DEPRECATED -DSUNOS5 -I/home/me/samba-30.25b/source/lib -D_SAMBA_BUILD_=3 -fPIC -c nsswitch/wb_common.c -o nsswitch/wb_common.o make: *** [nsswitch/wb_common.o] Error 1 /usr/include/unistd.h ... 328: /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 329: #if !defined(_XPG6) || defined(__EXTENSIONS__) 330: extern char *getpass(const char *); 331: #endif I don't see where its getting a syntax error
Ohh yeah, fixed it. The first part was that stdio.h was never getting included because the replace.h header was getting excluded which was the wrong action. Instead only the config.h should be excluded from loading because we are getting those from confdefs.h. When that fix was applied, it caused a compile error on wb_common.c. This was caused because winbind_nss_configure.h was including the lib/replace/system/passwd.h header in the wrong order. It was getting included before unistd.h causing it to define getpass to smbgetpass before unistd.h was loaded and it would crap out on a syntax error. So if you swap them around you get the proper results. Here are both patches needed to get this working. --- ../../samba-3.0.25b.orig/source/configure Tue Jun 26 13:35:53 2007 +++ configure Wed Aug 8 10:24:00 2007 @@ -19006,7 +19006,7 @@ /* end confdefs.h. */ #include "confdefs.h" -#define _LIBREPLACE_REPLACE_H +#define NO_CONFIG_H #define REPLACE_GETPASS 1 #define main dont_declare_main #include "$libreplacedir/getpass.c" --- ../../samba-3.0.25b.orig/source/nsswitch/winbind_nss_config.h Fri Apr 20 19:48:07 2007 +++ nsswitch/winbind_nss_config.h Wed Aug 8 10:49:56 2007 @@ -31,14 +31,13 @@ /* Include header files from data in config.h file */ - #ifndef NO_CONFIG_H #include "lib/replace/replace.h" #endif -#include "system/passwd.h" #include "system/filesys.h" #include "system/network.h" +#include "system/passwd.h" #include "nsswitch/winbind_nss.h"
Prolly help if its committed before I make it resolved ;)
*** Bug 4782 has been marked as a duplicate of this bug. ***
*** Bug 4677 has been marked as a duplicate of this bug. ***
*** Bug 4863 has been marked as a duplicate of this bug. ***
Created attachment 2990 [details] detects the getpassphrase() on the system
Created attachment 2991 [details] call the getpassphrase(3C) from the getsmbpass()
Created attachment 2992 [details] meed to getpass(3C) in the <unistd.h> is not affected by the redefinition All the bugs duplicated to Bug 4866 are related to Solaris. In this case should be more suitable to replace the getpass(3C) libc-call by the getpassphrase(3C) libc-call returning the 256-bytes long buffer instead of the 9-bytes long buffer. Here is the list of the affected files: samba-3.0.27/source/lib/replace/getpass.m4 samba-3.0.27/source/lib/replace/getpass.c samba-3.0.27/source/lib/replace/getpass.c ...per file patches are following my comment. Regards Jiri
*** Bug 4789 has been marked as a duplicate of this bug. ***
We now, since 532350877322cd3446cfa65459e82a45d5cef76c in Samba 4.2 use samba_getpass() and no longer try to compile such complex platform specific code in the configure process.