Bug 2474 - client/clitar.c / krb5-1.4 / compilation failure and solution(s)
Summary: client/clitar.c / krb5-1.4 / compilation failure and solution(s)
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.11
Hardware: x86 Linux
: P3 normal
Target Milestone: none
Assignee: Alexander J. Herrmann
QA Contact: Samba QA Contact
URL: http://newart4u.felixfrisch.de
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-17 01:18 UTC by Alexander J. Herrmann
Modified: 2005-08-24 10:19 UTC (History)
0 users

See Also:


Attachments
Patch to use regex (614 bytes, patch)
2005-03-17 01:33 UTC, Alexander J. Herrmann
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander J. Herrmann 2005-03-17 01:18:09 UTC
Versions:
gcc 3.4.3, samba 3.0.11 (stable), linux 2.6.11.3, krb5-1.4 (gss)

There is a slight problem within the configuration script and/or clitar.c.
clitar.c uses expresion matching found in regex.h or some other method based on 
HAVE_REGEX_H. 
HAVE_REGEX_H is defined as 1 within
/usr/local/include/gssapi/gssapi.h 
which is include from include/includes.h
Unfortunatly there seem to ba a misunderstanging beetween these as HAVE doesn't 
meen that it is included. 
samba itself dosn't include regex.h but there are a lot of solutions. Two of 
them are here:
1) Put a #undef HAVE_REGEX_H after the includes in client/clitar.c. (not really 
a fix as regex is never used leaving dead code)
2) Change all the HAVE_REGEX_H into _REGEX_H (not good same reason as above 
because it's never ever included)
-- or --
3) my favourite - make sure that regex.h is really included after everything 
else is included.
#ifdef HAVE_REGEX_H
#ifndef _REGEX_H
#include <regex.h>
#endif
#endif

Here's the diff -u for client/clitar.c which makes it work using the u*nix 
regex:

--- /aIEngine/util/server/samba-3.0.11/source/client/clitar.c   2004-12-15 
21:33:11.000000000 +0700
+++ client/clitar.c     2005-03-17 14:10:40.000000000 +0700
@@ -38,6 +38,15 @@
 #include "includes.h"
 #include "clitar.h"
 #include "client/client_proto.h"
+/* Fix by Alexander J. Herrmann <alexander_herrmann@yahoo.com.au>
+   make sure that regex.h is really included when gssapi.h is used
+   from krb5-1.4 as it only claims to have it without including it.
+*/
+#ifdef HAVE_REGEX_H
+#ifndef _REGEX_H
+#include <regex.h>
+#endif
+#endif
 
 static int clipfind(char **aret, int ret, char *tok);

*** End of diff -u  
Sorry I didn't bother to look into the CVS as somebody may allready fixed it. 
BTW. There's no good Pizza in Thailand. But I hope I did it the right way.
Regards,
Alexander
Comment 1 Alexander J. Herrmann 2005-03-17 01:33:06 UTC
Created attachment 1042 [details]
Patch to use regex 

Patch in order to include <regex.h> if samba is compiled with kerberos ant
client/clitar.c is used. Prevents compiler from aborting compilation. There is
maybe a issue as it may enable u*nix regex expression matching for the first
time as before it may be only have been dead code. 
In order to use regex expressions also whithout kerberos5 a change within
autoconfig would be necessary to define HAVE_REGEX_H when it is availible.
Comment 2 Gerald (Jerry) Carter (dead mail address) 2005-03-17 07:07:23 UTC
The offending code in clitar.c has already been removed.  The 
configure checks for regex.h were removed a long time ago.
Thanks for the patch (even though it won't be checked in).
Comment 3 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:19:45 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.