Patch for bug #1939 (nmblookup and multibyte characters)

Владимир Ворошило Владимир Ворошило
Mon May 22 07:54:57 GMT 2006


After applying this patch nmblookup corectly displays national chars in
workgroup and machine's name.

--- samba-3.0.22.orig/source/utils/nmblookup.c    2006-02-21 
02:33:23.000000000 +0600
+++ samba-3.0.22/source/utils/nmblookup.c    2006-05-18 
21:36:29.934167250 +0700
@@ -103,6 +103,12 @@
     struct node_status_extra extra;
     fstring cleanname;
 
+#if defined(HAVE_NL_LANGINFO) && defined(CODESET) && 
defined(HAVE_SETLOCALE)
+    char* old_locale;   
+    old_locale=smb_xstrdup(nl_langinfo(CODESET));
+    setlocale(LC_CTYPE,"");   
+#endif
+
     d_printf("Looking up status of %s\n",inet_ntoa(ip));
     make_nmb_name(&nname, name, type);
     status = node_status_query(fd,&nname,ip, &count, &extra);
@@ -125,6 +131,13 @@
     } else {
         d_printf("No reply from %s\n\n",inet_ntoa(ip));
     }
+#if defined(HAVE_NL_LANGINFO) && defined(CODESET) && 
defined(HAVE_SETLOCALE)
+    if (old_locale){
+        setlocale(LC_CTYPE,old_locale);
+        free(old_locale);
+    }
+#endif
+
 }
 
 

-- 
Vladimir Voroshilov	mailto:voroshil at univer.omsk.su
ICC, OmSU
JID: voroshil at jabber.ru
ICQ: 95587719




More information about the samba-technical mailing list