Patch to make code page directory configurable

Peter Polkinghorne Peter.Polkinghorne at brunel.ac.uk
Thu Mar 9 10:59:09 GMT 2000


Version Info: Samba 2.0.6 on Solaris 2.5.1 & 7, built with Sun C 5.0.

Rationale: Whereas most directories can be specified by configuration
directives, the code page directory is a compile time fix.  This patch makes
it configurable.

For most people this is not probably an issue, as the code page directory will
be local to the server.  For us this is not the case and slightly tricky to
do.  So it seemed easiest to add another configuration parameter.  It defaults
to the compile time CODEPAGEDIR.

Here are the patches - lib/charset.c & param/loadparm.c :

*** lib/charset.c       Fri Jan 28 14:07:02 2000
--- lib/charset.c.orig  Wed Oct 13 06:26:48 1999
***************
*** 195,207 ****
  
    DEBUG(5, ("load_client_codepage: loading codepage %d.\n", 
client_codepage));
  
!   if(strlen(lp_codepagedir()) + 14 > sizeof(codepage_file_name))
    {
      DEBUG(0,("load_client_codepage: filename too long to load\n"));
      return NULL;
    }
  
!   pstrcpy(codepage_file_name, lp_codepagedir());
    pstrcat(codepage_file_name, "/");
    pstrcat(codepage_file_name, "codepage.");
    slprintf(&codepage_file_name[strlen(codepage_file_name)], 
--- 195,207 ----
  
    DEBUG(5, ("load_client_codepage: loading codepage %d.\n", 
client_codepage));
  
!   if(strlen(CODEPAGEDIR) + 14 > sizeof(codepage_file_name))
    {
      DEBUG(0,("load_client_codepage: filename too long to load\n"));
      return NULL;
    }
  
!   pstrcpy(codepage_file_name, CODEPAGEDIR);
    pstrcat(codepage_file_name, "/");
    pstrcat(codepage_file_name, "codepage.");
    slprintf(&codepage_file_name[strlen(codepage_file_name)], 
***************
*** 348,360 ****
  #ifdef KANJI
      DEBUG(6,("codepage_initialise: loading dynamic codepage file 
%s/codepage.%d \
  for code page %d failed. Using default client codepage 932\n", 
!              lp_codepagedir(), client_codepage, client_codepage));
      cp = cp_932;
      client_codepage = KANJI_CODEPAGE;
  #else /* KANJI */
      DEBUG(6,("codepage_initialise: loading dynamic codepage file 
%s/codepage.%d \
  for code page %d failed. Using default client codepage 850\n", 
!              lp_codepagedir(), client_codepage, client_codepage));
      cp = cp_850;
      client_codepage = MSDOS_LATIN_1_CODEPAGE;
  #endif /* KANJI */
--- 348,360 ----
  #ifdef KANJI
      DEBUG(6,("codepage_initialise: loading dynamic codepage file 
%s/codepage.%d \
  for code page %d failed. Using default client codepage 932\n", 
!              CODEPAGEDIR, client_codepage, client_codepage));
      cp = cp_932;
      client_codepage = KANJI_CODEPAGE;
  #else /* KANJI */
      DEBUG(6,("codepage_initialise: loading dynamic codepage file 
%s/codepage.%d \
  for code page %d failed. Using default client codepage 850\n", 
!              CODEPAGEDIR, client_codepage, client_codepage));
      cp = cp_850;
      client_codepage = MSDOS_LATIN_1_CODEPAGE;
  #endif /* KANJI */
*** param/loadparm.c.orig       Thu Nov 11 02:36:05 1999
--- param/loadparm.c    Thu Mar  9 10:56:06 2000
***************
*** 158,163 ****
--- 158,164 ----
    char *szAddUserScript;
    char *szDelUserScript;
    char *szWINSHook;
+   char *szCodePageDir;
    int max_log_size;
    int mangled_stack;
    int max_xmit;
***************
*** 705,710 ****
--- 706,712 ----
    {"mangled stack",    P_INTEGER, P_GLOBAL, &Globals.mangled_stack,     
NULL,   NULL,  0},
    {"coding system",    P_STRING,  P_GLOBAL, &Globals.szCodingSystem,    
handle_coding_system, NULL,  0},
    {"client code page", P_INTEGER, P_GLOBAL, &Globals.client_code_page,       
handle_client_code_page,   NULL,  0},
+   {"code page directory", P_STRING, P_GLOBAL, &Globals.szCodePageDir,   
NULL,   NULL,  0},
    {"default case",     P_ENUM, P_LOCAL,  &sDefault.iDefaultCase,        
NULL,  enum_case, FLAG_SHARE},
    {"case sensitive",   P_BOOL,    P_LOCAL,  &sDefault.bCaseSensitive,   
NULL,   NULL,  FLAG_SHARE|FLAG_GLOBAL},
    {"casesignames",     P_BOOL,    P_LOCAL,  &sDefault.bCaseSensitive,   
NULL,   NULL,  0},
***************
*** 893,898 ****
--- 895,901 ----
    string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
  
    string_set(&Globals.szNameResolveOrder, "lmhosts host wins bcast");
+   string_set(&Globals.szCodePageDir, CODEPAGEDIR);
  
    Globals.bLoadPrinters = True;
    Globals.bUseRhosts = False;
***************
*** 1201,1206 ****
--- 1204,1210 ----
  FN_GLOBAL_STRING(lp_adduser_script,&Globals.szAddUserScript)
  FN_GLOBAL_STRING(lp_deluser_script,&Globals.szDelUserScript)
  FN_GLOBAL_STRING(lp_wins_hook,&Globals.szWINSHook)
+ FN_GLOBAL_STRING(lp_codepagedir,&Globals.szCodePageDir)
  
  FN_GLOBAL_STRING(lp_domain_groups,&Globals.szDomainGroups)
   FN_GLOBAL_STRING(lp_domain_admin_group,&Globals.szDomainAdminGroup)

-- 
-----------------------------------------------------------------------------
| Peter Polkinghorne, Computer Centre, Brunel University, Uxbridge, UB8 3PH,|
| Peter.Polkinghorne at brunel.ac.uk   +44 1895 274000 x2561       UK          |
-----------------------------------------------------------------------------




More information about the samba-technical mailing list