auth: move gensec_start.c to the top level
authorAndrew Bartlett <abartlet@samba.org>
Fri, 7 Oct 2011 06:24:12 +0000 (17:24 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 11 Oct 2011 02:41:36 +0000 (13:41 +1100)
This does not change who uses gensec for now, but makes it possible to
write new gensec modules outside source4/

Andrew Bartlett

auth/gensec/gensec.pc.in [moved from source4/auth/gensec/gensec.pc.in with 100% similarity]
auth/gensec/gensec_start.c [moved from source4/auth/gensec/gensec_start.c with 96% similarity]
auth/gensec/wscript_build
source3/wscript_build
source4/auth/gensec/cyrus_sasl.c
source4/auth/gensec/gensec_util.c [new file with mode: 0644]
source4/auth/gensec/schannel.c
source4/auth/gensec/wscript_build
source4/auth/ntlmssp/ntlmssp.c

similarity index 96%
rename from source4/auth/gensec/gensec_start.c
rename to auth/gensec/gensec_start.c
index 3150cced97307e9a5e0339f063ef6c533030981f..1322469dbe78e8cb26c47434e1059ddc88e64cd7 100644 (file)
@@ -825,39 +825,6 @@ _PUBLIC_ NTSTATUS gensec_set_credentials(struct gensec_security *gensec_security
        return NT_STATUS_OK;
 }
 
-NTSTATUS gensec_generate_session_info(TALLOC_CTX *mem_ctx,
-                                     struct gensec_security *gensec_security,
-                                     struct auth_user_info_dc *user_info_dc,
-                                     struct auth_session_info **session_info)
-{
-       NTSTATUS nt_status;
-       uint32_t session_info_flags = 0;
-
-       if (gensec_security->want_features & GENSEC_FEATURE_UNIX_TOKEN) {
-               session_info_flags |= AUTH_SESSION_INFO_UNIX_TOKEN;
-       }
-
-       session_info_flags |= AUTH_SESSION_INFO_DEFAULT_GROUPS;
-       if (user_info_dc->info->authenticated) {
-               session_info_flags |= AUTH_SESSION_INFO_AUTHENTICATED;
-       }
-
-       if (gensec_security->auth_context) {
-               nt_status = gensec_security->auth_context->generate_session_info(mem_ctx, gensec_security->auth_context,
-                                                                                user_info_dc,
-                                                                                session_info_flags,
-                                                                                session_info);
-       } else {
-               session_info_flags |= AUTH_SESSION_INFO_SIMPLE_PRIVILEGES;
-               nt_status = auth_generate_session_info(mem_ctx,
-                                                      NULL,
-                                                      NULL,
-                                                      user_info_dc, session_info_flags,
-                                                      session_info);
-       }
-       return nt_status;
-}
-
 /*
   register a GENSEC backend.
 
index a9203f801d0e1b79e1fb1248a4ac8ad8a9d1082d..e3e9372c3dfb81a62424928f071241a5649b0f27 100644 (file)
@@ -1,7 +1,11 @@
 #!/usr/bin/env python
+bld.SAMBA_LIBRARY('gensec',
+       source='gensec.c gensec_start.c',
+       pc_files='gensec.pc',
+       autoproto='gensec_toplevel_proto.h',
+       public_deps='tevent-util samba-util errors LIBPACKET auth_system_session samba-modules gensec_util',
+       public_headers='gensec.h',
+       deps='com_err',
+       vnum='0.0.1'
+       )
 
-bld.SAMBA_SUBSYSTEM('gensec_runtime',
-                    source='gensec.c',
-                    deps='tevent-util tevent samba-util LIBTSOCKET',
-                    public_headers='gensec.h',
-                    autoproto='gensec_toplevel_proto.h')
index 78b24746b36bc9affd17203ff7b642aad1cc86f1..c6a2dd5557542f206337b3b8255d6d2d2f847bb4 100755 (executable)
@@ -805,7 +805,7 @@ bld.SAMBA3_SUBSYSTEM('LIBSMB_ERR',
 
 bld.SAMBA3_SUBSYSTEM('LIBNTLMSSP',
                     source=LIBNTLMSSP_SRC,
-                    deps='LIBSMB_ERR NDR_NTLMSSP NTLMSSP_COMMON gensec_runtime',
+                    deps='LIBSMB_ERR NDR_NTLMSSP NTLMSSP_COMMON gensec',
                     vars=locals())
 
 bld.SAMBA3_LIBRARY('libsmb',
index 4a4422645d8432a1c6bafe31c0ad68e83e0a94a4..136bb8d43a990eecd65d4d5aa57411bf1c82144f 100644 (file)
@@ -24,6 +24,7 @@
 #include "auth/credentials/credentials.h"
 #include "auth/gensec/gensec.h"
 #include "auth/gensec/gensec_proto.h"
+#include "auth/gensec/gensec_toplevel_proto.h"
 #include <sasl/sasl.h>
 
 NTSTATUS gensec_sasl_init(void);
diff --git a/source4/auth/gensec/gensec_util.c b/source4/auth/gensec/gensec_util.c
new file mode 100644 (file)
index 0000000..267366a
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   Generic Authentication Interface
+
+   Copyright (C) Andrew Tridgell 2003
+   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2006
+
+   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
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "auth/gensec/gensec.h"
+#include "auth/auth.h"
+#include "auth/system_session_proto.h"
+
+NTSTATUS gensec_generate_session_info(TALLOC_CTX *mem_ctx,
+                                     struct gensec_security *gensec_security,
+                                     struct auth_user_info_dc *user_info_dc,
+                                     struct auth_session_info **session_info)
+{
+       NTSTATUS nt_status;
+       uint32_t session_info_flags = 0;
+
+       if (gensec_security->want_features & GENSEC_FEATURE_UNIX_TOKEN) {
+               session_info_flags |= AUTH_SESSION_INFO_UNIX_TOKEN;
+       }
+
+       session_info_flags |= AUTH_SESSION_INFO_DEFAULT_GROUPS;
+       if (user_info_dc->info->authenticated) {
+               session_info_flags |= AUTH_SESSION_INFO_AUTHENTICATED;
+       }
+
+       if (gensec_security->auth_context) {
+               nt_status = gensec_security->auth_context->generate_session_info(mem_ctx, gensec_security->auth_context,
+                                                                                user_info_dc,
+                                                                                session_info_flags,
+                                                                                session_info);
+       } else {
+               session_info_flags |= AUTH_SESSION_INFO_SIMPLE_PRIVILEGES;
+               nt_status = auth_generate_session_info(mem_ctx,
+                                                      NULL,
+                                                      NULL,
+                                                      user_info_dc, session_info_flags,
+                                                      session_info);
+       }
+       return nt_status;
+}
index b70d65a093aed416e2d33ce09721325f39262b03..35713ce0684afa27ab5acedc39010709ecededb6 100644 (file)
@@ -30,6 +30,7 @@
 #include "librpc/rpc/dcerpc.h"
 #include "param/param.h"
 #include "auth/gensec/schannel.h"
+#include "auth/gensec/gensec_toplevel_proto.h"
 
 _PUBLIC_ NTSTATUS gensec_schannel_init(void);
 
index a7fa12f56a34ef0109cc2f1a0568b3026775a59e..86d958950f34c644f90c6a46c09b54b2607d17e7 100644 (file)
@@ -1,14 +1,9 @@
 #!/usr/bin/env python
 
-bld.SAMBA_LIBRARY('gensec',
-       source='gensec_start.c socket.c gensec_tstream.c',
-       pc_files='gensec.pc',
-       autoproto='gensec_proto.h',
-       public_deps='tevent-util samba-util errors LIBPACKET auth_system_session gensec_runtime samba-modules',
-       public_headers='',
-       deps='com_err',
-       vnum='0.0.1'
-       )
+bld.SAMBA_SUBSYSTEM('gensec_util',
+                    source='socket.c gensec_tstream.c gensec_util.c',
+                    deps='tevent-util tevent samba-util LIBTSOCKET',
+                    autoproto='gensec_proto.h')
 
 bld.SAMBA_MODULE('gensec_krb5',
        source='gensec_krb5.c',
index d90c908d8d63ba893f76f838daa1da7b080eefc1..9b3aef0c65a234aeca1b2243b22521ba23c58b1a 100644 (file)
@@ -27,6 +27,7 @@
 #include "librpc/gen_ndr/ndr_dcerpc.h"
 #include "auth/gensec/gensec.h"
 #include "auth/gensec/gensec_proto.h"
+#include "auth/gensec/gensec_toplevel_proto.h"
 
 /**
  * Callbacks for NTLMSSP - for both client and server operating modes