samba/samba-3.0.8-non-ascii-domai...

116 lines
4.3 KiB
Diff

--- samba-3.0.8pre2/source/libsmb/clispnego.c 2004-10-25 17:05:00.000000000 -0400
+++ samba-3.0.8pre2-saved/source/libsmb/clispnego.c 2004-10-28 18:26:47.000000000 -0400
@@ -130,6 +130,8 @@
int i;
BOOL ret;
ASN1_DATA data;
+ char *tmp_ptr;
+ char *tmp_ptr2;
asn1_load(&data, blob);
@@ -152,7 +154,13 @@
asn1_start_tag(&data, ASN1_CONTEXT(3));
asn1_start_tag(&data, ASN1_SEQUENCE(0));
asn1_start_tag(&data, ASN1_CONTEXT(0));
- asn1_read_GeneralString(&data,principal);
+ tmp_ptr = NULL;
+ asn1_read_GeneralString(&data,&tmp_ptr);
+ convert_string_allocate ( 0, CH_MS_ANSI, CH_UTF8, tmp_ptr, 1 + strlen ( tmp_ptr ), &tmp_ptr2, False );
+ free ( tmp_ptr );
+ *principal = strdup ( tmp_ptr2 );
+ SAFE_FREE ( tmp_ptr2 );
+
asn1_end_tag(&data);
asn1_end_tag(&data);
asn1_end_tag(&data);
--- samba-3.0.8pre2/source/libads/ldap.c 2004-10-29 15:24:12.000000000 -0400
+++ samba-3.0.8pre2-saved/source/libads/ldap.c 2004-10-28 17:04:40.000000000 -0400
@@ -2408,7 +2408,8 @@
SAFE_FREE(ads->config.realm);
SAFE_FREE(ads->config.bind_path);
- ads->config.realm = strdup(p+2);
+ convert_string_allocate(0, CH_MS_ANSI, CH_UTF8,
+ p+2, 1+strlen(p+2), (void**)&(ads->config.realm), False);
ads->config.bind_path = ads_build_dn(ads->config.realm);
DEBUG(3,("got ldap server name %s@%s, using bind path: %s\n",
--- samba-3.0.8pre2/source/lib/charcnv.c 2004-10-25 17:05:00.000000000 -0400
+++ samba-3.0.8pre2-saved/source/lib/charcnv.c 2004-10-28 16:29:25.000000000 -0400
@@ -61,6 +61,7 @@
else if (ch == CH_DOS) ret = lp_dos_charset();
else if (ch == CH_DISPLAY) ret = lp_display_charset();
else if (ch == CH_UTF8) ret = "UTF8";
+ else if ( ch == CH_MS_ANSI ) ret = "CP1252";
#if defined(HAVE_NL_LANGINFO) && defined(CODESET)
if (ret && !strcmp(ret, "LOCALE")) {
--- samba-3.0.8pre2/source/include/charset.h 2004-10-25 17:05:06.000000000 -0400
+++ samba-3.0.8pre2-saved/source/include/charset.h 2004-10-28 16:37:03.000000000 -0400
@@ -20,9 +20,9 @@
*/
/* this defines the charset types used in samba */
-typedef enum {CH_UCS2=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4} charset_t;
+typedef enum {CH_UCS2=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4,CH_MS_ANSI=5} charset_t;
-#define NUM_CHARSETS 5
+#define NUM_CHARSETS 6
/*
* for each charset we have a function that pushes from that charset to a ucs2
diff -u -r samba-3.0.8pre2/source/include/config.h samba-3.0.8pre2-saved/source/include/config.h
diff -u -r samba-3.0.8pre2/source/utils/ntlm_auth.c samba-3.0.8pre2-nonascii/source/utils/ntlm_auth.c
--- samba-3.0.8pre2/source/utils/ntlm_auth.c 2004-11-03 15:02:20.000000000 -0500
+++ samba-3.0.8pre2-nonascii/source/utils/ntlm_auth.c 2004-11-03 10:01:09.000000000 -0500
@@ -1156,6 +1156,7 @@
return False;
}
+#if 0
principal = malloc(spnego.negTokenInit.mechListMIC.length+1);
if (principal == NULL) {
@@ -1166,6 +1167,11 @@
memcpy(principal, spnego.negTokenInit.mechListMIC.data,
spnego.negTokenInit.mechListMIC.length);
principal[spnego.negTokenInit.mechListMIC.length] = '\0';
+#else
+ convert_string_allocate(0, CH_MS_ANSI, CH_UTF8,
+spnego.negTokenInit.mechListMIC.data, spnego.negTokenInit.mechListMIC.length
+, (void**)&(principal), False);
+#endif
retval = cli_krb5_get_ticket(principal, 0, &tkt, &session_key_krb5);
--- samba-3.0.8/source/libads/kerberos.c.non-ascii-domain 2004-11-08 11:24:12.000000000 -0500
+++ samba-3.0.8/source/libads/kerberos.c 2004-11-08 11:34:47.000000000 -0500
@@ -319,6 +319,7 @@
krb5_data in_data;
krb5_auth_context auth_context = NULL;
krb5_error_code err = 0;
+ memset(&creds, '\0', sizeof(creds));
asprintf(&machine_account, "%s$@%s", global_myname(), lp_realm());
if (machine_account == NULL) {
@@ -329,9 +330,8 @@
goto out;
}
if ((err = kerberos_kinit_password(machine_account, password, 0, NULL, LIBADS_CCACHE_NAME)) != 0) {
- DEBUG(0,("get_service_ticket: kerberos_kinit_password %s@%s failed: %s\n",
+ DEBUG(0,("get_service_ticket: kerberos_kinit_password %s failed: %s\n",
machine_account,
- lp_realm(),
error_message(err)));
goto out;
}
@@ -340,7 +340,6 @@
ticket to ourselves. */
/* Set up the enctype and client and server principal fields for krb5_get_credentials. */
- memset(&creds, '\0', sizeof(creds));
kerberos_set_creds_enctype(&creds, enctype);
if ((err = krb5_cc_get_principal(ctx, ccache, &creds.client))) {