Add support for the new modules system to auth/ (merge from HEAD)
[jra/samba/.git] / source3 / auth / auth_winbind.c
index 5bdccd39f3e88543689091e12ba3a5c2bea42881..e2a292dd01505efca9900f5bb4df28f6ae2b7d13 100644 (file)
@@ -4,7 +4,7 @@
    Winbind authentication mechnism
 
    Copyright (C) Tim Potter 2000
-   Copyright (C) Andrew Bartlett 2001
+   Copyright (C) Andrew Bartlett 2001 - 2002
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
 
-/* Prototypes from common.h */
-
-NSS_STATUS winbindd_request(int req_type, 
-                           struct winbindd_request *request,
-                           struct winbindd_response *response);
-
-NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, NET_USER_INFO_3 *info3)
+static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *response, NET_USER_INFO_3 *info3)
 {
        uint8 *info3_ndr;
        size_t len = response->length - sizeof(response);
@@ -42,8 +36,8 @@ NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response *respo
                if (!prs_init(&ps, len, mem_ctx, UNMARSHALL)) {
                        return NT_STATUS_NO_MEMORY;
                }
-               prs_append_data(&ps, info3_ndr, len);
-               ps.data_offset = 0;
+               prs_copy_data_in(&ps, info3_ndr, len);
+               prs_set_offset(&ps,0);
                if (!net_io_user_info3("", info3, &ps, 1, 3)) {
                        DEBUG(2, ("get_info3_from_ndr: could not parse info3 struct!\n"));
                        return NT_STATUS_UNSUCCESSFUL;
@@ -133,11 +127,15 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
 /* module initialisation */
 NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char *param, auth_methods **auth_method) 
 {
-       if (!make_auth_methods(auth_context, auth_method)) {
+       if (!make_auth_methods(auth_context, auth_method))
                return NT_STATUS_NO_MEMORY;
-       }
 
        (*auth_method)->name = "winbind";
        (*auth_method)->auth = check_winbind_security;
        return NT_STATUS_OK;
 }
+
+int auth_winbind_init(void)
+{
+       return smb_register_auth("winbind", auth_init_winbind, AUTH_INTERFACE_VERSION);
+}