Bug 4866 - ./configure script does not compile getpass.c
Summary: ./configure script does not compile getpass.c
Status: REOPENED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.25b
Hardware: Other Solaris
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact: Samba QA Contact
URL:
Keywords:
: 4677 4782 4789 4863 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-07 17:33 UTC by Raul
Modified: 2007-11-27 06:23 UTC (History)
4 users (show)

See Also:


Attachments
detects the getpassphrase() on the system (922 bytes, patch)
2007-11-22 12:57 UTC, Jura Sasek
no flags Details
call the getpassphrase(3C) from the getsmbpass() (617 bytes, patch)
2007-11-22 12:59 UTC, Jura Sasek
no flags Details
meed to getpass(3C) in the <unistd.h> is not affected by the redefinition (344 bytes, patch)
2007-11-22 13:07 UTC, Jura Sasek
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Raul 2007-08-07 17:33:08 UTC
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.
Comment 1 Raul 2007-08-08 09:25:20 UTC
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
Comment 2 Raul 2007-08-08 11:58:19 UTC
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"

Comment 3 Raul 2007-08-16 14:08:34 UTC
Prolly help if its committed before I make it resolved ;)
Comment 4 Gerald (Jerry) Carter (dead mail address) 2007-08-20 13:43:31 UTC
*** Bug 4782 has been marked as a duplicate of this bug. ***
Comment 5 Gerald (Jerry) Carter (dead mail address) 2007-08-20 13:43:49 UTC
*** Bug 4677 has been marked as a duplicate of this bug. ***
Comment 6 Gerald (Jerry) Carter (dead mail address) 2007-08-20 13:47:04 UTC
*** Bug 4863 has been marked as a duplicate of this bug. ***
Comment 7 Jura Sasek 2007-11-22 12:57:12 UTC
Created attachment 2990 [details]
detects the getpassphrase() on the system
Comment 8 Jura Sasek 2007-11-22 12:59:36 UTC
Created attachment 2991 [details]
call the getpassphrase(3C) from the getsmbpass()
Comment 9 Jura Sasek 2007-11-22 13:07:19 UTC
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
Comment 10 Svein Olav Bjerkeset 2007-11-27 06:23:25 UTC
*** Bug 4789 has been marked as a duplicate of this bug. ***