lib/util_unistr.c

ソースコードを見る。

関数

void gfree_case_tables (void)
 Destroy global objects allocated by load_case_tables()
void load_case_tables (void)
 Load or generate the case handling tables.
int check_dos_char (smb_ucs2_t c)
static int check_dos_char_slowly (smb_ucs2_t c)
void init_doschar_table (void)
 Fill out doschar table the hard way, by examining each character
void init_valid_table (void)
 Load the valid character map table from valid.dat or create from the configured codepage.
size_t dos_PutUniCode (char *dst, const char *src, size_t len, BOOL null_terminate)
char * skip_unibuf (char *src, size_t len)
int rpcstr_pull (char *dest, void *src, int dest_len, int src_len, int flags)
int rpcstr_pull_unistr2_fstring (char *dest, UNISTR2 *src)
char * rpcstr_pull_unistr2_talloc (TALLOC_CTX *mem_ctx, const UNISTR2 *src)
int rpcstr_push (void *dest, const char *src, size_t dest_len, int flags)
void unistr2_to_ascii (char *dest, const UNISTR2 *str, size_t maxlen)
void unistr3_to_ascii (char *dest, const UNISTR3 *str, size_t maxlen)
const char * unistr2_static (const UNISTR2 *str)
char * unistr2_tdup (TALLOC_CTX *ctx, const UNISTR2 *str)
smb_ucs2_t toupper_w (smb_ucs2_t val)
smb_ucs2_t tolower_w (smb_ucs2_t val)
BOOL islower_w (smb_ucs2_t c)
BOOL isupper_w (smb_ucs2_t c)
BOOL isvalid83_w (smb_ucs2_t c)
size_t strlen_w (const smb_ucs2_t *src)
size_t strnlen_w (const smb_ucs2_t *src, size_t max)
smb_ucs2_tstrchr_w (const smb_ucs2_t *s, smb_ucs2_t c)
smb_ucs2_tstrchr_wa (const smb_ucs2_t *s, char c)
smb_ucs2_tstrrchr_w (const smb_ucs2_t *s, smb_ucs2_t c)
smb_ucs2_tstrnrchr_w (const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n)
smb_ucs2_tstrstr_w (const smb_ucs2_t *s, const smb_ucs2_t *ins)
BOOL strlower_w (smb_ucs2_t *s)
BOOL strupper_w (smb_ucs2_t *s)
void strnorm_w (smb_ucs2_t *s, int case_default)
int strcmp_w (const smb_ucs2_t *a, const smb_ucs2_t *b)
int strncmp_w (const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len)
int strcasecmp_w (const smb_ucs2_t *a, const smb_ucs2_t *b)
int strncasecmp_w (const smb_ucs2_t *a, const smb_ucs2_t *b, size_t len)
BOOL strequal_w (const smb_ucs2_t *s1, const smb_ucs2_t *s2)
BOOL strnequal_w (const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t n)
smb_ucs2_tstrdup_w (const smb_ucs2_t *src)
smb_ucs2_tstrndup_w (const smb_ucs2_t *src, size_t len)
smb_ucs2_tstrncpy_w (smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max)
smb_ucs2_tstrncat_w (smb_ucs2_t *dest, const smb_ucs2_t *src, const size_t max)
smb_ucs2_tstrcat_w (smb_ucs2_t *dest, const smb_ucs2_t *src)
void string_replace_w (smb_ucs2_t *s, smb_ucs2_t oldc, smb_ucs2_t newc)
BOOL trim_string_w (smb_ucs2_t *s, const smb_ucs2_t *front, const smb_ucs2_t *back)
int strcmp_wa (const smb_ucs2_t *a, const char *b)
int strncmp_wa (const smb_ucs2_t *a, const char *b, size_t len)
smb_ucs2_tstrpbrk_wa (const smb_ucs2_t *s, const char *p)
smb_ucs2_tstrstr_wa (const smb_ucs2_t *s, const char *ins)
BOOL trim_string_wa (smb_ucs2_t *s, const char *front, const char *back)
int unistrlen (uint16 *s)
int unistrcpy (uint16 *dst, uint16 *src)
UNISTR2ucs2_to_unistr2 (TALLOC_CTX *ctx, UNISTR2 *dst, smb_ucs2_t *src)
 Samba ucs2 type to UNISTR2 conversion
int toupper_ascii (int c)
int tolower_ascii (int c)
int isupper_ascii (int c)
int islower_ascii (int c)

変数

static smb_ucs2_tupcase_table
static smb_ucs2_tlowcase_table
static uint8 * valid_table
static BOOL upcase_table_use_unmap
static BOOL lowcase_table_use_unmap
static BOOL valid_table_use_unmap
static uint8 doschar_table [8192]
 This table says which Unicode characters are valid dos characters.


関数

void gfree_case_tables ( void   ) 

Destroy global objects allocated by load_case_tables()

util_unistr.c49 行で定義されています。

参照先 lowcase_tablelowcase_table_use_unmapunmap_file()upcase_tableupcase_table_use_unmapvalid_tablevalid_table_use_unmap.

参照元 gfree_all().

00050 {
00051         if ( upcase_table ) {
00052                 if ( upcase_table_use_unmap )
00053                         unmap_file(upcase_table, 0x20000);
00054                 else
00055                         SAFE_FREE(upcase_table);
00056         }
00057 
00058         if ( lowcase_table ) {
00059                 if ( lowcase_table_use_unmap )
00060                         unmap_file(lowcase_table, 0x20000);
00061                 else
00062                         SAFE_FREE(lowcase_table);
00063         }
00064 
00065         if ( valid_table ) {
00066                 if ( valid_table_use_unmap )
00067                         unmap_file(valid_table, 0x10000);
00068                 else
00069                         SAFE_FREE(valid_table);
00070         }
00071 }

void load_case_tables ( void   ) 

Load or generate the case handling tables.

The case tables are defined in UCS2 and don't depend on any configured parameters, so they never need to be reloaded.

util_unistr.c80 行で定義されています。

参照先 initialisedlib_path()lowcase_tablelowcase_table_use_unmapmap_file()upcase_tableupcase_table_use_unmap.

参照元 lazy_initialize_conv()main()nss_wins_init()pam_sm_acct_mgmt()pam_sm_authenticate()pam_sm_chauthtok()parse_quota_set()py_samba_init()smb_krb5_locator_init()smbc_init_context().

00081 {
00082         static int initialised;
00083         char *old_locale = NULL, *saved_locale = NULL;
00084         int i;
00085 
00086         if (initialised) {
00087                 return;
00088         }
00089         initialised = 1;
00090 
00091         upcase_table = (smb_ucs2_t *)map_file(lib_path("upcase.dat"),
00092                                               0x20000);
00093         upcase_table_use_unmap = ( upcase_table != NULL );
00094 
00095         lowcase_table = (smb_ucs2_t *)map_file(lib_path("lowcase.dat"),
00096                                                0x20000);
00097         lowcase_table_use_unmap = ( lowcase_table != NULL );
00098 
00099 #ifdef HAVE_SETLOCALE
00100         /* Get the name of the current locale.  */
00101         old_locale = setlocale(LC_ALL, NULL);
00102 
00103         if (old_locale) {
00104                 /* Save it as it is in static storage. */
00105                 saved_locale = SMB_STRDUP(old_locale);
00106         }
00107 
00108         /* We set back the locale to C to get ASCII-compatible toupper/lower functions. */
00109         setlocale(LC_ALL, "C");
00110 #endif
00111 
00112         /* we would like Samba to limp along even if these tables are
00113            not available */
00114         if (!upcase_table) {
00115                 DEBUG(1,("creating lame upcase table\n"));
00116                 upcase_table = (smb_ucs2_t *)SMB_MALLOC(0x20000);
00117                 for (i=0;i<0x10000;i++) {
00118                         smb_ucs2_t v;
00119                         SSVAL(&v, 0, i);
00120                         upcase_table[v] = i;
00121                 }
00122                 for (i=0;i<256;i++) {
00123                         smb_ucs2_t v;
00124                         SSVAL(&v, 0, UCS2_CHAR(i));
00125                         upcase_table[v] = UCS2_CHAR(islower(i)?toupper(i):i);
00126                 }
00127         }
00128 
00129         if (!lowcase_table) {
00130                 DEBUG(1,("creating lame lowcase table\n"));
00131                 lowcase_table = (smb_ucs2_t *)SMB_MALLOC(0x20000);
00132                 for (i=0;i<0x10000;i++) {
00133                         smb_ucs2_t v;
00134                         SSVAL(&v, 0, i);
00135                         lowcase_table[v] = i;
00136                 }
00137                 for (i=0;i<256;i++) {
00138                         smb_ucs2_t v;
00139                         SSVAL(&v, 0, UCS2_CHAR(i));
00140                         lowcase_table[v] = UCS2_CHAR(isupper(i)?tolower(i):i);
00141                 }
00142         }
00143 
00144 #ifdef HAVE_SETLOCALE
00145         /* Restore the old locale. */
00146         if (saved_locale) {
00147                 setlocale (LC_ALL, saved_locale);
00148                 SAFE_FREE(saved_locale);
00149         }
00150 #endif
00151 }

int check_dos_char ( smb_ucs2_t  c  ) 

util_unistr.c158 行で定義されています。

参照先 doschar_tablelazy_initialize_conv().

参照元 init_valid_table()main().

00159 {
00160         lazy_initialize_conv();
00161         
00162         /* Find the right byte, and right bit within the byte; return
00163          * 1 or 0 */
00164         return (doschar_table[(c & 0xffff) / 8] & (1 << (c & 7))) != 0;
00165 }

static int check_dos_char_slowly ( smb_ucs2_t  c  )  [static]

util_unistr.c168 行で定義されています。

参照先 bufCH_DOSCH_UTF16LEconvert_string().

参照元 init_doschar_table().

00169 {
00170         char buf[10];
00171         smb_ucs2_t c2 = 0;
00172         int len1, len2;
00173 
00174         len1 = convert_string(CH_UTF16LE, CH_DOS, &c, 2, buf, sizeof(buf),False);
00175         if (len1 == 0) {
00176                 return 0;
00177         }
00178         len2 = convert_string(CH_DOS, CH_UTF16LE, buf, len1, &c2, 2,False);
00179         if (len2 != 2) {
00180                 return 0;
00181         }
00182         return (c == c2);
00183 }

void init_doschar_table ( void   ) 

Fill out doschar table the hard way, by examining each character

util_unistr.c190 行で定義されています。

参照先 ccheck_dos_char_slowly()doschar_table.

参照元 init_iconv().

00191 {
00192         int i, j, byteval;
00193 
00194         /* For each byte of packed table */
00195         
00196         for (i = 0; i <= 0xffff; i += 8) {
00197                 byteval = 0;
00198                 for (j = 0; j <= 7; j++) {
00199                         smb_ucs2_t c;
00200 
00201                         c = i + j;
00202                         
00203                         if (check_dos_char_slowly(c)) {
00204                                 byteval |= 1 << j;
00205                         }
00206                 }
00207                 doschar_table[i/8] = byteval;
00208         }
00209 }

void init_valid_table ( void   ) 

Load the valid character map table from valid.dat or create from the configured codepage.

This function is called whenever the configuration is reloaded. However, the valid character table is not changed if it's loaded from a file, because we can't unmap files.

util_unistr.c221 行で定義されています。

参照先 ccheck_dos_char()lib_path()map_file()valid_tablevalid_table_use_unmap.

参照元 init_iconv().

00222 {
00223         static int mapped_file;
00224         int i;
00225         const char *allowed = ".!#$%&'()_-@^`~";
00226         uint8 *valid_file;
00227 
00228         if (mapped_file) {
00229                 /* Can't unmap files, so stick with what we have */
00230                 return;
00231         }
00232 
00233         valid_file = (uint8 *)map_file(lib_path("valid.dat"), 0x10000);
00234         if (valid_file) {
00235                 valid_table = valid_file;
00236                 mapped_file = 1;
00237                 valid_table_use_unmap = True;
00238                 return;
00239         }
00240 
00241         /* Otherwise, we're using a dynamically created valid_table.
00242          * It might need to be regenerated if the code page changed.
00243          * We know that we're not using a mapped file, so we can
00244          * free() the old one. */
00245         if (valid_table) 
00246                 SAFE_FREE(valid_table);
00247 
00248         /* use free rather than unmap */
00249         valid_table_use_unmap = False;
00250 
00251         DEBUG(2,("creating default valid table\n"));
00252         valid_table = (uint8 *)SMB_MALLOC(0x10000);
00253         for (i=0;i<128;i++) {
00254                 valid_table[i] = isalnum(i) || strchr(allowed,i);
00255         }
00256         
00257         for (;i<0x10000;i++) {
00258                 smb_ucs2_t c;
00259                 SSVAL(&c, 0, i);
00260                 valid_table[i] = check_dos_char(c);
00261         }
00262 }

size_t dos_PutUniCode ( char *  dst,
const char *  src,
size_t  len,
BOOL  null_terminate 
)

util_unistr.c275 行で定義されています。

参照先 flagspush_ucs2().

参照元 call_trans2qfilepathinfo()process_logon_packet()send_getdc_request().

00276 {
00277         int flags = null_terminate ? STR_UNICODE|STR_NOALIGN|STR_TERMINATE
00278                                    : STR_UNICODE|STR_NOALIGN;
00279         return push_ucs2(NULL, dst, src, len, flags);
00280 }

char* skip_unibuf ( char *  src,
size_t  len 
)

util_unistr.c288 行で定義されています。

参照元 process_logon_packet()receive_getdc_response()uniarray_2_dosarray().

00289 {
00290         char *srcend = src + len;
00291 
00292         while (src < srcend && SVAL(src,0)) {
00293                 src += 2;
00294         }
00295 
00296         if(!SVAL(src,0)) {
00297                 src += 2;
00298         }
00299 
00300         return src;
00301 }

int rpcstr_pull ( char *  dest,
void *  src,
int  dest_len,
int  src_len,
int  flags 
)

util_unistr.c307 行で定義されています。

参照先 pull_ucs2().

参照元 _eventlog_clear_eventlog()_eventlog_open_eventlog()_lsa_add_acct_rights()_lsa_remove_acct_rights()_net_auth()_net_auth_2()_net_req_chal()_net_sam_logoff()_net_sam_logon_internal()_net_srv_pwset()_ntsvcs_get_device_list()_ntsvcs_get_device_list_size()_ntsvcs_get_device_reg_property()_reg_create_key_ex()_reg_delete_key()_reg_delete_value()_reg_open_entry()_reg_query_value()_reg_restore_key()_reg_save_key()_reg_set_value()_reg_shutdown_ex()_samr_chgpasswd_user()_samr_chgpasswd_user3()_samr_lookup_domain()_samr_lookup_names()_spoolss_xcvdataport()_srv_net_name_validate()_svcctl_get_display_name()_svcctl_open_service()cac_MakeRegValueData()cac_unistr_ascii()cmd_spoolss_addprinterdriver()cmd_spoolss_enum_printerkey()convert_devicemode()convert_port_data_1()convert_values_to_printer_info_2()copy_print_driver_3()decrypt_trustdom_secret()display_form()display_job_info_1()display_job_info_2()display_port_info_1()display_port_info_2()display_print_driver_1()display_print_driver_2()display_print_driver_3()display_print_info_0()display_print_info_1()display_print_info_2()display_print_info_7()display_printdriverdir_1()display_reg_value()dump_regval_buffer()dump_values()from_unistr_list()fstr_pull()fstr_pull2()is_printer_published()regval_convert_multi_sz()regval_sz()rpc_printer_list_internals()rpc_printer_migrate_drivers_internals()rpc_printer_migrate_forms_internals()rpc_printer_migrate_printers_internals()rpc_printer_migrate_security_internals()rpc_printer_migrate_settings_internals()rpc_printer_publish_internals_args()rpc_printer_publish_list_internals()rpc_service_list_internal()rpc_service_status_internal()rpccli_lsa_enum_account_rights()rpccli_lsa_enum_trust_dom()rpccli_reg_enum_key()rpccli_spoolss_enumprinterdata()rpccli_spoolss_enumprinterdataex()rpccli_svcctl_get_dispname()set_user_info_21()set_user_info_7()spoolss_enumports()spoolss_enumprinterdrivers()spoolss_enumprinters()spoolss_hnd_enumforms()svcctl_lookup_description()svcctl_lookup_dispname()uniarray_2_dosarray().

00308 {
00309         if (!src) {
00310                 dest[0] = 0;
00311                 return 0;
00312         }
00313         if(dest_len==-1) {
00314                 dest_len=MAXUNI-3;
00315         }
00316         return pull_ucs2(NULL, dest, src, dest_len, src_len, flags|STR_UNICODE|STR_NOALIGN);
00317 }

int rpcstr_pull_unistr2_fstring ( char *  dest,
UNISTR2 src 
)

util_unistr.c323 行で定義されています。

参照先 UNISTR2::bufferpull_ucs2()UNISTR2::uni_str_len.

参照元 _samr_get_dispenum_index()_srv_net_sess_del()display_file_info_3()display_share_info_1()display_share_info_2()display_share_info_502()net_share_enum_rpc()rpc_share_migrate_files_internals()rpc_share_migrate_security_internals()rpc_share_migrate_shares_internals()rpccli_lsa_enum_privilege()rpccli_lsa_get_dispname()rpccli_lsa_lookup_sids()rpccli_netlogon_getanydcname().

00324 {
00325         return pull_ucs2(NULL, dest, src->buffer, sizeof(fstring),
00326                          src->uni_str_len * 2, 0);
00327 }

char* rpcstr_pull_unistr2_talloc ( TALLOC_CTX mem_ctx,
const UNISTR2 src 
)

util_unistr.c337 行で定義されています。

参照先 UNISTR2::bufferpull_ucs2()resulttalloc_strdup()UNISTR2::uni_str_len.

参照元 _samr_create_dom_group()_samr_create_user()browse_host_rpc()get_rpc_shares()lookup_lsa_rids()lookup_lsa_sids()pull_domain_controller_info_from_getdcname_reply()rpc_sh_share_info()rpc_sh_user_flag_edit_internals()rpc_sh_user_str_edit_internals()rpccli_lsa_lookup_names()rpccli_netlogon_dsr_getsitename().

00338 {
00339         pstring tmp;
00340         size_t result;
00341 
00342         result = pull_ucs2(NULL, tmp, src->buffer, sizeof(tmp),
00343                            src->uni_str_len * 2, 0);
00344         if (result == (size_t)-1) {
00345                 return NULL;
00346         }
00347 
00348         return talloc_strdup(mem_ctx, tmp);
00349 }

int rpcstr_push ( void *  dest,
const char *  src,
size_t  dest_len,
int  flags 
)

util_unistr.c354 行で定義されています。

参照先 push_ucs2().

参照元 _reg_perfcount_get_instance_info()_reg_perfcount_init_data_block()_spoolss_enumprinterdata()cac_MakeRpcDataBlob()cmd_spoolss_setprinterdata()init_rpc_blob_str()init_unistr()init_unistr2()init_unistr3()init_unistr_array()parse_logentry()setup_ver2_dfs_referral()setup_ver3_dfs_referral()spoolss_notify_comment()spoolss_notify_datatype()spoolss_notify_driver_name()spoolss_notify_job_name()spoolss_notify_job_status_string()spoolss_notify_location()spoolss_notify_parameters()spoolss_notify_port_name()spoolss_notify_print_processor()spoolss_notify_printer_name()spoolss_notify_sepfile()spoolss_notify_server_name()spoolss_notify_share_name()spoolss_notify_username().

00355 {
00356         return push_ucs2(NULL, dest, src, dest_len, flags|STR_UNICODE|STR_NOALIGN);
00357 }

void unistr2_to_ascii ( char *  dest,
const UNISTR2 str,
size_t  maxlen 
)

util_unistr.c363 行で定義されています。

参照先 UNISTR2::bufferpull_ucs2()UNISTR2::uni_str_len.

参照元 _dfs_Add()_dfs_GetInfo()_dfs_Remove()_lsa_lookup_priv_value()_lsa_priv_get_dispname()_net_logon_ctrl2()_samr_create_dom_alias()_samr_set_aliasinfo()_samr_set_groupinfo()_spoolss_deleteprinterdata()_spoolss_deleteprinterdataex()_spoolss_deleteprinterdriver()_spoolss_deleteprinterdriverex()_spoolss_deleteprinterkey()_spoolss_enumprinterdataex()_spoolss_enumprinterdrivers()_spoolss_enumprinterkey()_spoolss_enumprinters()_spoolss_getform()_spoolss_getprinterdata()_spoolss_getprinterdataex()_spoolss_getprinterdriver2()_spoolss_open_printer_ex()_spoolss_rffpcnex()_spoolss_setprinterdata()_spoolss_setprinterdataex()_spoolss_startdocprinter()_srv_net_file_query_secdesc()_srv_net_file_set_secdesc()_srv_net_share_add()_srv_net_share_del()_srv_net_share_get_info()_srv_net_share_set_info()add_a_form()append_info3_as_txt()delete_a_form()display_dfs_info_1()display_dfs_info_2()display_dfs_info_3()display_group_info1()display_group_info2()display_group_info4()display_group_info5()display_query_info_12()display_query_info_3()display_query_info_5()display_sam_info_1()display_sam_info_2()display_sam_info_3()display_sam_sync()display_sam_unk_info_2()display_sam_unk_info_4()display_sam_unk_info_5()display_sam_unk_info_6()display_sam_user_info_21()display_sam_user_info_7()display_srv_info_101()display_srv_info_102()fetch_account_info_to_ldif()fetch_alias_info()fetch_alias_info_to_ldif()fetch_database_to_ldif()fetch_domain_info()fetch_group_info()fetch_group_info_to_ldif()get_a_builtin_ntform()getprinterdriverdir_level_1()getprintprocessordirectory_level_1()query_user_list()reply_spnego_kerberos()rpc_group_delete_internals()rpc_group_list_internals()rpc_user_list_internals()rpccli_reg_enum_val()rpccli_reg_query_key()rpccli_samr_enum_als_groups()rpccli_samr_enum_dom_groups()rpccli_samr_enum_dom_users()rpccli_samr_lookup_rids()talloc_unistr2_to_ascii()uni_2_asc_printer_driver_3()uni_2_asc_printer_driver_6()uni_2_asc_printer_info_2()unistr2_static()update_a_form().

00364 {
00365         if (str == NULL) {
00366                 *dest='\0';
00367                 return;
00368         }
00369         pull_ucs2(NULL, dest, str->buffer, maxlen, str->uni_str_len*2, STR_NOALIGN);
00370 }

void unistr3_to_ascii ( char *  dest,
const UNISTR3 str,
size_t  maxlen 
)

util_unistr.c376 行で定義されています。

参照先 UNISTR::bufferpull_ucs2()UNISTR3::strUNISTR3::uni_str_len.

00377 {
00378         if (str == NULL) {
00379                 *dest='\0';
00380                 return;
00381         }
00382         pull_ucs2(NULL, dest, str->str.buffer, maxlen, str->uni_str_len*2,
00383                   STR_NOALIGN);
00384 }

const char* unistr2_static ( const UNISTR2 str  ) 

util_unistr.c390 行で定義されています。

参照先 unistr2_to_ascii().

参照元 copy_id21_to_sam_passwd()copy_id23_to_sam_passwd()copy_id25_to_sam_passwd()display_account_info()display_alias_info()display_domain_info()display_group_info()display_trust_dom_info_1()display_trust_dom_info_6()fetch_account_info()make_server_info_info3()sam_account_from_delta().

00391 {
00392         static pstring ret;
00393         unistr2_to_ascii(ret, str, sizeof(ret));
00394         return ret;
00395 }

char* unistr2_tdup ( TALLOC_CTX ctx,
const UNISTR2 str 
)

util_unistr.c402 行で定義されています。

参照先 UNISTR2::bufferpull_ucs2()UNISTR2::uni_str_len.

参照元 get_share_info()make_server_info_info3()query_user()rpc_group_list_internals()rpc_info_internals()rpccli_ds_enum_domain_trusts()rpccli_lsa_query_info_policy()rpccli_lsa_query_info_policy2()rpccli_srvsvc_net_file_enum()rpccli_srvsvc_net_share_enum()rpccli_srvsvc_net_share_get_info()winbindd_dual_pam_auth()winbindd_dual_pam_auth_crap().

00403 {
00404         char *s;
00405         int maxlen = (str->uni_str_len+1)*4;
00406         if (!str->buffer) {
00407                 return NULL;
00408         }
00409         s = (char *)TALLOC(ctx, maxlen); /* convervative */
00410         if (!s) {
00411                 return NULL;
00412         }
00413         pull_ucs2(NULL, s, str->buffer, maxlen, str->uni_str_len*2, STR_NOALIGN);
00414         return s;
00415 }

smb_ucs2_t toupper_w ( smb_ucs2_t  val  ) 

util_unistr.c421 行で定義されています。

参照先 upcase_table.

参照元 ms_fnmatch_core()push_ucs2()strcasecmp_w()strncasecmp_w()strupper_w()toupper_ascii().

00422 {
00423         return upcase_table[SVAL(&val,0)];
00424 }

smb_ucs2_t tolower_w ( smb_ucs2_t  val  ) 

util_unistr.c430 行で定義されています。

参照先 lowcase_table.

参照元 strcasecmp_w()strlower_w()strncasecmp_w()tolower_ascii().

00431 {
00432         return lowcase_table[SVAL(&val,0)];
00433 }

BOOL islower_w ( smb_ucs2_t  c  ) 

util_unistr.c439 行で定義されています。

参照先 upcase_table.

参照元 islower_ascii()strhaslower().

00440 {
00441         return upcase_table[SVAL(&c,0)] != c;
00442 }

BOOL isupper_w ( smb_ucs2_t  c  ) 

util_unistr.c448 行で定義されています。

参照先 lowcase_table.

参照元 isupper_ascii()strhasupper().

00449 {
00450         return lowcase_table[SVAL(&c,0)] != c;
00451 }

BOOL isvalid83_w ( smb_ucs2_t  c  ) 

util_unistr.c457 行で定義されています。

参照先 valid_table.

参照元 has_valid_83_chars().

00458 {
00459         return valid_table[SVAL(&c,0)] != 0;
00460 }

size_t strlen_w ( const smb_ucs2_t src  ) 

util_unistr.c466 行で定義されています。

参照先 clen.

参照元 _reg_perfcount_get_instance_info()_reg_perfcount_init_data_block()all_string_sub_w()convert_string_internal()E_md4hash()init_unistr2()init_unistr2_w()is_8_3_w()is_valid_name()mangle_get_prefix()map_multi_sz()parse_logentry()pull_ucs2_allocate()pull_ucs2_talloc()secrets_store_trusted_domain_password()str_charnum()strcat_w()strncat_w()strndup_w()strnrchr_w()strrchr_w()strstr_w()test_plaintext()trim_string_w()ucs2_to_unistr2().

00467 {
00468         size_t len;
00469         smb_ucs2_t c;
00470 
00471         for(len = 0; *(COPY_UCS2_CHAR(&c,src)); src++, len++) {
00472                 ;
00473         }
00474 
00475         return len;
00476 }

size_t strnlen_w ( const smb_ucs2_t src,
size_t  max 
)

util_unistr.c482 行で定義されています。

参照先 clen.

参照元 pull_ucs2()strncat_w().

00483 {
00484         size_t len;
00485         smb_ucs2_t c;
00486 
00487         for(len = 0; (len < max) && *(COPY_UCS2_CHAR(&c,src)); src++, len++) {
00488                 ;
00489         }
00490 
00491         return len;
00492 }

smb_ucs2_t* strchr_w ( const smb_ucs2_t s,
smb_ucs2_t  c 
)

util_unistr.c498 行で定義されています。

参照元 is_valid_name()strchr_m()strchr_wa()strstr_w()strstr_wa().

00499 {
00500         smb_ucs2_t cp;
00501         while (*(COPY_UCS2_CHAR(&cp,s))) {
00502                 if (c == cp) {
00503                         return (smb_ucs2_t *)s;
00504                 }
00505                 s++;
00506         }
00507         if (c == cp) {
00508                 return (smb_ucs2_t *)s;
00509         }
00510 
00511         return NULL;
00512 }

smb_ucs2_t* strchr_wa ( const smb_ucs2_t s,
char  c 
)

util_unistr.c514 行で定義されています。

参照先 strchr_w().

参照元 is_8_3_w().

00515 {
00516         return strchr_w(s, UCS2_CHAR(c));
00517 }

smb_ucs2_t* strrchr_w ( const smb_ucs2_t s,
smb_ucs2_t  c 
)

util_unistr.c523 行で定義されています。

参照先 lenstrlen_w().

参照元 mangle_get_prefix()ms_fnmatch()strrchr_m().

00524 {
00525         smb_ucs2_t cp;
00526         const smb_ucs2_t *p = s;
00527         int len = strlen_w(s);
00528 
00529         if (len == 0) {
00530                 return NULL;
00531         }
00532         p += (len - 1);
00533         do {
00534                 if (c == *(COPY_UCS2_CHAR(&cp,p))) {
00535                         return (smb_ucs2_t *)p;
00536                 }
00537         } while (p-- != s);
00538         return NULL;
00539 }

smb_ucs2_t* strnrchr_w ( const smb_ucs2_t s,
smb_ucs2_t  c,
unsigned int  n 
)

util_unistr.c545 行で定義されています。

参照先 lenstrlen_w().

参照元 strnrchr_m().

00546 {
00547         smb_ucs2_t cp;
00548         const smb_ucs2_t *p = s;
00549         int len = strlen_w(s);
00550 
00551         if (len == 0 || !n) {
00552                 return NULL;
00553         }
00554         p += (len - 1);
00555         do {
00556                 if (c == *(COPY_UCS2_CHAR(&cp,p))) {
00557                         n--;
00558                 }
00559 
00560                 if (!n) {
00561                         return (smb_ucs2_t *)p;
00562                 }
00563         } while (p-- != s);
00564         return NULL;
00565 }

smb_ucs2_t* strstr_w ( const smb_ucs2_t s,
const smb_ucs2_t ins 
)

util_unistr.c571 行で定義されています。

参照先 strchr_w()strlen_w()strncmp_w().

参照元 all_string_sub_w()strstr_m().

00572 {
00573         smb_ucs2_t *r;
00574         size_t inslen;
00575 
00576         if (!s || !*s || !ins || !*ins) {
00577                 return NULL;
00578         }
00579 
00580         inslen = strlen_w(ins);
00581         r = (smb_ucs2_t *)s;
00582 
00583         while ((r = strchr_w(r, *ins))) {
00584                 if (strncmp_w(r, ins, inslen) == 0) {
00585                         return r;
00586                 }
00587                 r++;
00588         }
00589 
00590         return NULL;
00591 }

BOOL strlower_w ( smb_ucs2_t s  ) 

util_unistr.c598 行で定義されています。

参照先 tolower_w().

参照元 strdup_lower()strnorm_w()unix_strlower().

00599 {
00600         smb_ucs2_t cp;
00601         BOOL ret = False;
00602 
00603         while (*(COPY_UCS2_CHAR(&cp,s))) {
00604                 smb_ucs2_t v = tolower_w(cp);
00605                 if (v != cp) {
00606                         COPY_UCS2_CHAR(s,&v);
00607                         ret = True;
00608                 }
00609                 s++;
00610         }
00611         return ret;
00612 }

BOOL strupper_w ( smb_ucs2_t s  ) 

util_unistr.c619 行で定義されています。

参照先 toupper_w().

参照元 is_valid_name()ntv2_owf_gen()strdup_upper()strnorm_w()unix_strupper().

00620 {
00621         smb_ucs2_t cp;
00622         BOOL ret = False;
00623         while (*(COPY_UCS2_CHAR(&cp,s))) {
00624                 smb_ucs2_t v = toupper_w(cp);
00625                 if (v != cp) {
00626                         COPY_UCS2_CHAR(s,&v);
00627                         ret = True;
00628                 }
00629                 s++;
00630         }
00631         return ret;
00632 }

void strnorm_w ( smb_ucs2_t s,
int  case_default 
)

util_unistr.c638 行で定義されています。

参照先 CASE_UPPERstrlower_w()strupper_w().

00639 {
00640         if (case_default == CASE_UPPER) {
00641                 strupper_w(s);
00642         } else {
00643                 strlower_w(s);
00644         }
00645 }

int strcmp_w ( const smb_ucs2_t a,
const smb_ucs2_t b 
)

util_unistr.c647 行で定義されています。

00648 {
00649         smb_ucs2_t cpa, cpb;
00650 
00651         while ((*(COPY_UCS2_CHAR(&cpb,b))) && (*(COPY_UCS2_CHAR(&cpa,a)) == cpb)) {
00652                 a++;
00653                 b++;
00654         }
00655         return (*(COPY_UCS2_CHAR(&cpa,a)) - *(COPY_UCS2_CHAR(&cpb,b)));
00656         /* warning: if *a != *b and both are not 0 we return a random
00657                 greater or lesser than 0 number not realted to which
00658                 string is longer */
00659 }

int strncmp_w ( const smb_ucs2_t a,
const smb_ucs2_t b,
size_t  len 
)

util_unistr.c661 行で定義されています。

参照元 strstr_w()trim_string_w().

00662 {
00663         smb_ucs2_t cpa, cpb;
00664         size_t n = 0;
00665 
00666         while ((n < len) && (*(COPY_UCS2_CHAR(&cpb,b))) && (*(COPY_UCS2_CHAR(&cpa,a)) == cpb)) {
00667                 a++;
00668                 b++;
00669                 n++;
00670         }
00671         return (len - n)?(*(COPY_UCS2_CHAR(&cpa,a)) - *(COPY_UCS2_CHAR(&cpb,b))):0;
00672 }

int strcasecmp_w ( const smb_ucs2_t a,
const smb_ucs2_t b 
)

util_unistr.c678 行で定義されています。

参照先 tolower_w()toupper_w().

参照元 StrCaseCmp()strequal_w().

00679 {
00680         smb_ucs2_t cpa, cpb;
00681 
00682         while ((*COPY_UCS2_CHAR(&cpb,b)) && toupper_w(*(COPY_UCS2_CHAR(&cpa,a))) == toupper_w(cpb)) {
00683                 a++;
00684                 b++;
00685         }
00686         return (tolower_w(*(COPY_UCS2_CHAR(&cpa,a))) - tolower_w(*(COPY_UCS2_CHAR(&cpb,b))));
00687 }

int strncasecmp_w ( const smb_ucs2_t a,
const smb_ucs2_t b,
size_t  len 
)

util_unistr.c693 行で定義されています。

参照先 tolower_w()toupper_w().

参照元 strnequal_w().

00694 {
00695         smb_ucs2_t cpa, cpb;
00696         size_t n = 0;
00697 
00698         while ((n < len) && *COPY_UCS2_CHAR(&cpb,b) && (toupper_w(*(COPY_UCS2_CHAR(&cpa,a))) == toupper_w(cpb))) {
00699                 a++;
00700                 b++;
00701                 n++;
00702         }
00703         return (len - n)?(tolower_w(*(COPY_UCS2_CHAR(&cpa,a))) - tolower_w(*(COPY_UCS2_CHAR(&cpb,b)))):0;
00704 }

BOOL strequal_w ( const smb_ucs2_t s1,
const smb_ucs2_t s2 
)

util_unistr.c710 行で定義されています。

参照先 strcasecmp_w().

00711 {
00712         if (s1 == s2) {
00713                 return(True);
00714         }
00715         if (!s1 || !s2) {
00716                 return(False);
00717         }
00718   
00719         return(strcasecmp_w(s1,s2)==0);
00720 }

BOOL strnequal_w ( const smb_ucs2_t s1,
const smb_ucs2_t s2,
size_t  n 
)

util_unistr.c726 行で定義されています。

参照先 strncasecmp_w().

00727 {
00728         if (s1 == s2) {
00729                 return(True);
00730         }
00731         if (!s1 || !s2 || !n) {
00732                 return(False);
00733         }
00734   
00735         return(strncasecmp_w(s1,s2,n)==0);
00736 }

smb_ucs2_t* strdup_w ( const smb_ucs2_t src  ) 

util_unistr.c742 行で定義されています。

参照先 strndup_w().

参照元 is_valid_name()mangle_get_prefix().

00743 {
00744         return strndup_w(src, 0);
00745 }

smb_ucs2_t* strndup_w ( const smb_ucs2_t src,
size_t  len 
)

util_unistr.c749 行で定義されています。

参照先 strlen_w().

参照元 strdup_w().

00750 {
00751         smb_ucs2_t *dest;
00752         
00753         if (!len) {
00754                 len = strlen_w(src);
00755         }
00756         dest = SMB_MALLOC_ARRAY(smb_ucs2_t, len + 1);
00757         if (!dest) {
00758                 DEBUG(0,("strdup_w: out of memory!\n"));
00759                 return NULL;
00760         }
00761 
00762         memcpy(dest, src, len * sizeof(smb_ucs2_t));
00763         dest[len] = 0;
00764         return dest;
00765 }

smb_ucs2_t* strncpy_w ( smb_ucs2_t dest,
const smb_ucs2_t src,
const size_t  max 
)

util_unistr.c771 行で定義されています。

参照先 len.

参照元 init_unistr2_w()secrets_store_trusted_domain_password()ucs2_to_unistr2().

00772 {
00773         smb_ucs2_t cp;
00774         size_t len;
00775         
00776         if (!dest || !src) {
00777                 return NULL;
00778         }
00779         
00780         for (len = 0; (*COPY_UCS2_CHAR(&cp,(src+len))) && (len < max); len++) {
00781                 cp = *COPY_UCS2_CHAR(dest+len,src+len);
00782         }
00783         cp = 0;
00784         for ( /*nothing*/ ; len < max; len++ ) {
00785                 cp = *COPY_UCS2_CHAR(dest+len,&cp);
00786         }
00787         
00788         return dest;
00789 }

smb_ucs2_t* strncat_w ( smb_ucs2_t dest,
const smb_ucs2_t src,
const size_t  max 
)

util_unistr.c795 行で定義されています。

参照先 lenstrlen_w()strnlen_w().

00796 {       
00797         size_t start;
00798         size_t len;     
00799         smb_ucs2_t z = 0;
00800 
00801         if (!dest || !src) {
00802                 return NULL;
00803         }
00804         
00805         start = strlen_w(dest);
00806         len = strnlen_w(src, max);
00807 
00808         memcpy(&dest[start], src, len*sizeof(smb_ucs2_t));                      
00809         z = *COPY_UCS2_CHAR(dest+start+len,&z);
00810 
00811         return dest;
00812 }

smb_ucs2_t* strcat_w ( smb_ucs2_t dest,
const smb_ucs2_t src 
)

util_unistr.c814 行で定義されています。

参照先 lenstrlen_w().

00815 {       
00816         size_t start;
00817         size_t len;     
00818         smb_ucs2_t z = 0;
00819         
00820         if (!dest || !src) {
00821                 return NULL;
00822         }
00823         
00824         start = strlen_w(dest);
00825         len = strlen_w(src);
00826 
00827         memcpy(&dest[start], src, len*sizeof(smb_ucs2_t));                      
00828         z = *COPY_UCS2_CHAR(dest+start+len,&z);
00829         
00830         return dest;
00831 }

void string_replace_w ( smb_ucs2_t s,
smb_ucs2_t  oldc,
smb_ucs2_t  newc 
)

util_unistr.c838 行で定義されています。

00839 {
00840         smb_ucs2_t cp;
00841 
00842         for(;*(COPY_UCS2_CHAR(&cp,s));s++) {
00843                 if(cp==oldc) {
00844                         COPY_UCS2_CHAR(s,&newc);
00845                 }
00846         }
00847 }

BOOL trim_string_w ( smb_ucs2_t s,
const smb_ucs2_t front,
const smb_ucs2_t back 
)

util_unistr.c853 行で定義されています。

参照先 lenstrlen_w()strncmp_w().

参照元 trim_string_wa().

00855 {
00856         BOOL ret = False;
00857         size_t len, front_len, back_len;
00858 
00859         if (!s) {
00860                 return False;
00861         }
00862 
00863         len = strlen_w(s);
00864 
00865         if (front && *front) {
00866                 front_len = strlen_w(front);
00867                 while (len && strncmp_w(s, front, front_len) == 0) {
00868                         memmove(s, (s + front_len), (len - front_len + 1) * sizeof(smb_ucs2_t));
00869                         len -= front_len;
00870                         ret = True;
00871                 }
00872         }
00873         
00874         if (back && *back) {
00875                 back_len = strlen_w(back);
00876                 while (len && strncmp_w((s + (len - back_len)), back, back_len) == 0) {
00877                         s[len - back_len] = 0;
00878                         len -= back_len;
00879                         ret = True;
00880                 }
00881         }
00882 
00883         return ret;
00884 }

int strcmp_wa ( const smb_ucs2_t a,
const char *  b 
)

util_unistr.c894 行で定義されています。

参照元 is_8_3_w()is_valid_name().

00895 {
00896         smb_ucs2_t cp = 0;
00897 
00898         while (*b && *(COPY_UCS2_CHAR(&cp,a)) == UCS2_CHAR(*b)) {
00899                 a++;
00900                 b++;
00901         }
00902         return (*(COPY_UCS2_CHAR(&cp,a)) - UCS2_CHAR(*b));
00903 }

int strncmp_wa ( const smb_ucs2_t a,
const char *  b,
size_t  len 
)

util_unistr.c905 行で定義されています。

参照元 strstr_wa().

00906 {
00907         smb_ucs2_t cp = 0;
00908         size_t n = 0;
00909 
00910         while ((n < len) && *b && *(COPY_UCS2_CHAR(&cp,a)) == UCS2_CHAR(*b)) {
00911                 a++;
00912                 b++;
00913                 n++;
00914         }
00915         return (len - n)?(*(COPY_UCS2_CHAR(&cp,a)) - UCS2_CHAR(*b)):0;
00916 }

smb_ucs2_t* strpbrk_wa ( const smb_ucs2_t s,
const char *  p 
)

util_unistr.c918 行で定義されています。

00919 {
00920         smb_ucs2_t cp;
00921 
00922         while (*(COPY_UCS2_CHAR(&cp,s))) {
00923                 int i;
00924                 for (i=0; p[i] && cp != UCS2_CHAR(p[i]); i++) 
00925                         ;
00926                 if (p[i]) {
00927                         return (smb_ucs2_t *)s;
00928                 }
00929                 s++;
00930         }
00931         return NULL;
00932 }

smb_ucs2_t* strstr_wa ( const smb_ucs2_t s,
const char *  ins 
)

util_unistr.c934 行で定義されています。

参照先 strchr_w()strncmp_wa().

00935 {
00936         smb_ucs2_t *r;
00937         size_t inslen;
00938 
00939         if (!s || !ins) { 
00940                 return NULL;
00941         }
00942 
00943         inslen = strlen(ins);
00944         r = (smb_ucs2_t *)s;
00945 
00946         while ((r = strchr_w(r, UCS2_CHAR(*ins)))) {
00947                 if (strncmp_wa(r, ins, inslen) == 0) 
00948                         return r;
00949                 r++;
00950         }
00951 
00952         return NULL;
00953 }

BOOL trim_string_wa ( smb_ucs2_t s,
const char *  front,
const char *  back 
)

util_unistr.c955 行で定義されています。

参照先 push_ucs2()trim_string_w().

00957 {
00958         wpstring f, b;
00959 
00960         if (front) {
00961                 push_ucs2(NULL, f, front, sizeof(wpstring) - 1, STR_TERMINATE);
00962         } else {
00963                 *f = 0;
00964         }
00965         if (back) {
00966                 push_ucs2(NULL, b, back, sizeof(wpstring) - 1, STR_TERMINATE);
00967         } else {
00968                 *b = 0;
00969         }
00970         return trim_string_w(s, f, b);
00971 }

int unistrlen ( uint16 *  s  ) 

util_unistr.c977 行で定義されています。

参照先 len.

参照元 cac_unistr_ascii()dup_devicemode().

00978 {
00979         int len;
00980 
00981         if (!s) {
00982                 return -1;
00983         }
00984 
00985         for (len=0; SVAL(s,0); s++,len++) {
00986                 ;
00987         }
00988 
00989         return len;
00990 }

int unistrcpy ( uint16 *  dst,
uint16 *  src 
)

util_unistr.c997 行で定義されています。

参照元 dup_devicemode().

00998 {
00999         int num_wchars = 0;
01000 
01001         while (SVAL(src,0)) {
01002                 *dst++ = *src++;
01003                 num_wchars++;
01004         }
01005         *dst = 0;
01006 
01007         return num_wchars;
01008 }

UNISTR2* ucs2_to_unistr2 ( TALLOC_CTX ctx,
UNISTR2 dst,
smb_ucs2_t src 
)

Samba ucs2 type to UNISTR2 conversion

引数:
ctx Talloc context to create the dst strcture (if null) and the contents of the unicode string.
dst UNISTR2 destination. If equals null, then it's allocated.
src smb_ucs2_t source.
max_len maximum number of unicode characters to copy. If equals null, then null-termination of src is taken
戻り値:
copied UNISTR2 destination

util_unistr.c1023 行で定義されています。

参照先 UNISTR2::bufferlenUNISTR2::offsetstrlen_w()strncpy_w()UNISTR2::uni_max_lenUNISTR2::uni_str_len.

01024 {
01025         size_t len;
01026 
01027         if (!src) {
01028                 return NULL;
01029         }
01030 
01031         len = strlen_w(src);
01032         
01033         /* allocate UNISTR2 destination if not given */
01034         if (!dst) {
01035                 dst = TALLOC_P(ctx, UNISTR2);
01036                 if (!dst)
01037                         return NULL;
01038         }
01039         if (!dst->buffer) {
01040                 dst->buffer = TALLOC_ARRAY(ctx, uint16, len + 1);
01041                 if (!dst->buffer)
01042                         return NULL;
01043         }
01044         
01045         /* set UNISTR2 parameters */
01046         dst->uni_max_len = len + 1;
01047         dst->offset = 0;
01048         dst->uni_str_len = len;
01049         
01050         /* copy the actual unicode string */
01051         strncpy_w(dst->buffer, src, dst->uni_max_len);
01052         
01053         return dst;
01054 }

int toupper_ascii ( int  c  ) 

util_unistr.c1060 行で定義されています。

参照先 toupper_w().

参照元 is_mangled()name_map()pdb_gethexhours()pdb_gethexpwd()StrCaseCmp()strdup_upper()strhex_to_str()string_combinations2()stripspaceupper()strupper_m()strwicmp()uname_string_combinations2().

01061 {
01062         smb_ucs2_t uc = toupper_w(UCS2_CHAR(c));
01063         return UCS2_TO_CHAR(uc);
01064 }

int tolower_ascii ( int  c  ) 

util_unistr.c1070 行で定義されています。

参照先 tolower_w().

参照元 cache_mangled_name()init_tables()strlower_m()writetarheader().

01071 {
01072         smb_ucs2_t uc = tolower_w(UCS2_CHAR(c));
01073         return UCS2_TO_CHAR(uc);
01074 }

int isupper_ascii ( int  c  ) 

util_unistr.c1080 行で定義されています。

参照先 isupper_w().

参照元 alpha_strcpy_fn().

01081 {
01082         return isupper_w(UCS2_CHAR(c));
01083 }

int islower_ascii ( int  c  ) 

util_unistr.c1089 行で定義されています。

参照先 islower_w().

参照元 alpha_strcpy_fn()string_combinations2()uname_string_combinations2().

01090 {
01091         return islower_w(UCS2_CHAR(c));
01092 }


変数

smb_ucs2_t* upcase_table [static]

util_unistr.c31 行で定義されています。

参照元 gfree_case_tables()islower_w()load_case_tables()toupper_w().

smb_ucs2_t* lowcase_table [static]

util_unistr.c32 行で定義されています。

参照元 gfree_case_tables()isupper_w()load_case_tables()tolower_w().

uint8* valid_table [static]

util_unistr.c33 行で定義されています。

参照元 gfree_case_tables()init_valid_table()isvalid83_w().

BOOL upcase_table_use_unmap [static]

util_unistr.c34 行で定義されています。

参照元 gfree_case_tables()load_case_tables().

BOOL lowcase_table_use_unmap [static]

util_unistr.c35 行で定義されています。

参照元 gfree_case_tables()load_case_tables().

BOOL valid_table_use_unmap [static]

util_unistr.c36 行で定義されています。

参照元 gfree_case_tables()init_valid_table().

uint8 doschar_table[8192] [static]

This table says which Unicode characters are valid dos characters.

Each value is just a single bit.

util_unistr.c44 行で定義されています。

参照元 check_dos_char()init_doschar_table().


Sambaに対してSat Aug 29 21:23:41 2009に生成されました。  doxygen 1.4.7