method_version struct member in nsswitch/winbind_nss_aix.c
Albert Chin
samba-technical at mlists.thewrittenword.com
Fri Jul 23 04:26:22 GMT 2004
On Thu, Jul 22, 2004 at 06:03:23PM -0500, Albert Chin wrote:
> AIX 4.3.x and 5.1 don't have method_version as a member of struct
> secmethod_table so nsswitch/winbind_nss_aix.c fails to compile:
> ...
>
> int wb_aix_init(struct secmethod_table *methods)
> {
> ZERO_STRUCTP(methods);
>
> methods->method_version = SECMETHOD_VERSION_520;
>
> methods->method_getgrgid = wb_aix_getgrgid;
> ...
>
> Should I just add an autoconf test for method_version and #ifdef the
> method_version code? Can method_version safely be ignored?
For AIX 4.3.3, looks like more is method_attrlist is missing as well.
For AIX 4.3.2, it's hopeless :)
The patch below makes Samba 3.0.5 build on AIX 4.3.3 and 5.1. The
wb_aix_getpwuid() part of the patch is to avoid an error generated by
the IBM C compiler. It doesn't like prototypes at function scope.
--
albert chin (china at thewrittenword.com)
-- snip snip
--- source/nsswitch/winbind_nss_aix.c.orig 2004-07-22 17:57:41.710776000 -0500
+++ source/nsswitch/winbind_nss_aix.c 2004-07-22 19:33:28.593076000 -0500
@@ -159,12 +159,13 @@
return id;
}
+static struct passwd *wb_aix_getpwuid(uid_t uid);
+
static char *decode_user(const char *name)
{
struct passwd *pwd;
unsigned id;
char *ret;
- static struct passwd *wb_aix_getpwuid(uid_t uid);
sscanf(name+1, "%u", &id);
pwd = wb_aix_getpwuid(id);
@@ -741,6 +742,7 @@
return;
}
+#ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_ATTRLIST
/*
return a list of additional attributes supported by the backend
*/
@@ -764,6 +766,7 @@
return ret;
}
+#endif
/*
@@ -977,7 +980,9 @@
{
ZERO_STRUCTP(methods);
+#ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_VERSION
methods->method_version = SECMETHOD_VERSION_520;
+#endif
methods->method_getgrgid = wb_aix_getgrgid;
methods->method_getgrnam = wb_aix_getgrnam;
@@ -997,7 +1002,9 @@
methods->method_passwdrestrictions = wb_aix_passwdrestrictions;
methods->method_getgracct = wb_aix_getgracct;
methods->method_getgrusers = wb_aix_getgrusers;
+#ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_ATTRLIST
methods->method_attrlist = wb_aix_attrlist;
+#endif
#if LOG_UNIMPLEMENTED_CALLS
methods->method_delgroup = method_delgroup;
--- source/configure.in.orig 2004-07-22 16:14:18.829288000 -0500
+++ source/configure.in 2004-07-22 19:33:41.849514000 -0500
@@ -4173,6 +4174,13 @@
AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),,
[#include <pwd.h>])
+# AIX 4.3.x and 5.1 do not have as many members in
+# struct secmethod_table as AIX 5.2
+AC_CHECK_MEMBERS([struct secmethod_table.method_attrlist], , ,
+ [#include <usersec.h>])
+AC_CHECK_MEMBERS([struct secmethod_table.method_version], , ,
+ [#include <usersec.h>])
+
#################################################
# Check to see if we should use the included popt
More information about the samba-technical
mailing list