The Samba-Bugzilla – Attachment 1588 Details for
Bug 3156
Strange bug occuring due to usage of a username map and long printer names:
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
remove use of find_service when looking for a printername specifically
look (text/plain), 6.35 KB, created by
Gerald (Jerry) Carter (dead mail address)
on 2005-11-22 08:46:33 UTC
(
hide
)
Description:
remove use of find_service when looking for a printername specifically
Filename:
MIME Type:
Creator:
Gerald (Jerry) Carter (dead mail address)
Created:
2005-11-22 08:46:33 UTC
Size:
6.35 KB
patch
obsolete
>Index: rpc_server/srv_spoolss_nt.c >=================================================================== >--- rpc_server/srv_spoolss_nt.c (revision 11859) >+++ rpc_server/srv_spoolss_nt.c (working copy) >@@ -479,29 +479,30 @@ > DEBUGADD(5, ("searching for [%s]\n", aprinter )); > > /* Search all sharenames first as this is easier than pulling >- the printer_info_2 off of disk */ >+ the printer_info_2 off of disk. Don't use find_service() since >+ that calls out to map_username() */ > >- snum = find_service(aprinter); >- >- if ( lp_snum_ok(snum) && lp_print_ok(snum) ) { >- found = True; >- fstrcpy( sname, aprinter ); >- } >- > /* do another loop to look for printernames */ > > for (snum=0; !found && snum<n_services; snum++) { > >- /* no point in checking if this is not a printer or >- we aren't allowing printername != sharename */ >+ /* no point going on if this is not a printer */ > >- if ( !(lp_snum_ok(snum) >- && lp_print_ok(snum) >- && !lp_force_printername(snum)) ) >- { >+ if ( !(lp_snum_ok(snum) && lp_print_ok(snum)) ) > continue; >+ >+ fstrcpy(sname, lp_servicename(snum)); >+ if ( strequal( aprinter, sname ) ) { >+ found = True; >+ break; > } >+ >+ /* no point looking up the printer object if >+ we aren't allowing printername != sharename */ > >+ if ( lp_force_printername(snum) ) >+ continue; >+ > fstrcpy(sname, lp_servicename(snum)); > > printer = NULL; >@@ -524,6 +525,7 @@ > > if ( strequal(printername, aprinter) ) { > found = True; >+ break; > } > > DEBUGADD(10, ("printername: %s\n", printername)); >Index: passdb/pdb_nds.c >=================================================================== >--- passdb/pdb_nds.c (revision 11859) >+++ passdb/pdb_nds.c (working copy) >@@ -846,12 +846,17 @@ > > /* Turn on ssl if required */ > if(strequal(protocol, "ldaps")) { >+#ifdef LDAP_OPT_X_TLS > int tls = LDAP_OPT_X_TLS_HARD; > if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS) { > DEBUG(1, ("pdb_nds_update_login_attempts: Failed to setup a TLS session\n")); > } else { > DEBUG(4, ("pdb_nds_update_login_attempts: Activated TLS on session\n")); > } >+#else >+ DEBUG(0,("pdb_nds_update_login_attempts: Secure connection not supported by LDAP client libraries!\n")); >+ return NT_STATUS_INVALID_PARAMETER; >+#endif > } > } > >Index: include/includes.h >=================================================================== >--- include/includes.h (revision 11859) >+++ include/includes.h (working copy) >@@ -458,10 +458,19 @@ > > #if HAVE_LBER_H > #include <lber.h> >+#ifndef LBER_USE_DER >+#define LBER_USE_DER 0x01 > #endif >+#endif > > #if HAVE_LDAP_H > #include <ldap.h> >+#ifndef LDAP_CONST >+#define LDAP_CONST const >+#endif >+#ifndef LDAP_OPT_SUCCESS >+#define LDAP_OPT_SUCCESS 0 >+#endif > #else > #undef HAVE_LDAP > #endif >Index: configure.in >=================================================================== >--- configure.in (revision 11859) >+++ configure.in (working copy) >@@ -2796,8 +2796,6 @@ > # now see if we can find the ldap libs in standard paths > AC_CHECK_LIB_EXT(ldap, LDAP_LIBS, ldap_init) > >- AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS) >- > ######################################################## > # If we have LDAP, does it's rebind procedure take 2 or 3 arguments? > # Check found in pam_ldap 145. >@@ -2816,9 +2814,7 @@ > > AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS, $smb_ldap_cv_ldap_set_rebind_proc, [Number of arguments to ldap_set_rebind_proc]) > >- AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS) >- >- if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes" -a x"$ac_cv_func_ext_ldap_domain2hostlist" = x"yes"; then >+ if test x"$ac_cv_lib_ext_ldap_ldap_init" = x"yes"; then > AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available]) > CPPFLAGS="$CPPFLAGS -DLDAP_DEPRECATED" > default_static_modules="$default_static_modules pdb_ldap idmap_ldap"; >@@ -2870,6 +2866,36 @@ > with_ads_support=no > fi > >+AC_CHECK_FUNC_EXT(ldap_initialize,$LDAP_LIBS) >+ >+if test x"$ac_cv_func_ext_ldap_initialize" != x"yes"; then >+ if test x"$with_ads_support" = x"yes"; then >+ AC_MSG_ERROR(Active Directory Support requires ldap_initialize) >+ fi >+ AC_MSG_WARN(Active Directory Support requires ldap_initialize) >+ with_ads_support=no >+fi >+ >+AC_CHECK_FUNC_EXT(ldap_domain2hostlist,$LDAP_LIBS) >+ >+if test x"$ac_cv_func_ext_ldap_domain2hostlist" != x"yes"; then >+ if test x"$with_ads_support" = x"yes"; then >+ AC_MSG_ERROR(Active Directory Support requires ldap_domain2hostlist) >+ fi >+ AC_MSG_WARN(Active Directory Support requires ldap_domain2hostlist) >+ with_ads_support=no >+fi >+ >+AC_CHECK_FUNC_EXT(ldap_add_result_entry,$LDAP_LIBS) >+ >+if test x"$ac_cv_func_ext_ldap_add_result_entry" != x"yes"; then >+ if test x"$with_ads_support" = x"yes"; then >+ AC_MSG_ERROR(Active Directory Support requires ldap_add_result_entry) >+ fi >+ AC_MSG_WARN(Active Directory Support requires ldap_add_result_entry) >+ with_ads_support=no >+fi >+ > if test x"$with_ads_support" != x"no"; then > > # Do no harm to the values of CFLAGS and LIBS while testing for >Index: libads/ldap.c >=================================================================== >--- libads/ldap.c (revision 11859) >+++ libads/ldap.c (working copy) >@@ -577,8 +577,10 @@ > status = ads_do_paged_search(ads, bind_path, scope, expr, attrs, res, > &count, &cookie); > >- if (!ADS_ERR_OK(status)) return status; >+ if (!ADS_ERR_OK(status)) >+ return status; > >+#ifdef HAVE_LDAP_ADD_RESULT_ENTRY > while (cookie) { > void *res2 = NULL; > ADS_STATUS status2; >@@ -598,6 +600,10 @@ > /* note that we do not free res2, as the memory is now > part of the main returned list */ > } >+#else >+ DEBUG(0, ("no ldap_add_result_entry() support in LDAP libs!\n")); >+ status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL); >+#endif > > return status; > } >Index: registry/reg_printing.c >=================================================================== >--- registry/reg_printing.c (revision 11859) >+++ registry/reg_printing.c (working copy) >@@ -227,7 +227,16 @@ > > reg_split_path( printers_key, &printername, &printerdatakey ); > >- if ( find_service(printername) == -1 >+ /* validate the printer name */ >+ >+ for (snum=0; snum<n_services; snum++) { >+ if ( !lp_snum_ok(snum) || !lp_print_ok(snum) ) >+ continue; >+ if (strequal( lp_servicename(snum), printername ) ) >+ break; >+ } >+ >+ if ( snum>=n_services > || !W_ERROR_IS_OK( get_a_printer(NULL, &printer, 2, printername) ) ) > { > return -1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3156
:
1588
|
1589