OpenVAS Libraries  8.0.3
Macros | Typedefs | Functions
charcnv.c File Reference

Character-set conversion routines built on our iconv. More...

#include "byteorder.h"
#include "iconv.h"
#include "smb.h"
#include "proto.h"
#include "openvas_logging.h"

Macros

#define uint8   uint8_t
 
#define uint16   uint16_t
 
#define _PUBLIC_
 
#define False   0
 
#define True   1
 

Typedefs

typedef unsigned int bool
 

Functions

size_t convert_string_ntlmssp (charset_t from, charset_t to, void const *src, size_t srclen, void *dest, size_t destlen, bool allow_badcharcnv)
 
char lp_failed_convert_char_ntlmssp (void)
 
void init_valid_table_ntlmssp (void)
 
size_t strlen_w_ntlmssp (const uint16 *src)
 
_PUBLIC_ void strupper_m_ntlmssp (char *s)
 
void lazy_initialize_conv_ntlmssp (void)
 
void init_iconv_ntlmssp (void)
 
size_t push_ascii_ntlmssp (void *dest, const char *src, size_t dest_len, int flags)
 

Detailed Description

Character-set conversion routines built on our iconv.

Note
Samba's internal character set (at least in the 3.0 series) is always the same as the one for the Unix filesystem. It is not necessarily UTF-8 and may be different on machines that need i18n filenames to be compatible with Unix software. It does have to be a superset of ASCII. All multibyte sequences must start with a byte with the high bit set.
See also
lib/iconv.c

Macro Definition Documentation

#define _PUBLIC_
#define False   0
#define True   1
#define uint16   uint16_t
#define uint8   uint8_t

Typedef Documentation

typedef unsigned int bool

Function Documentation

size_t convert_string_ntlmssp ( charset_t  from,
charset_t  to,
void const *  src,
size_t  srclen,
void *  dest,
size_t  destlen,
bool  allow_bad_conv 
)

Convert string from one encoding to another, making error checking etc Fast path version - handles ASCII first.

Parameters
srcpointer to source string (multibyte or singlebyte)
srclenlength of the source string in bytes, or -1 for nul terminated.
destpointer to destination string (multibyte or singlebyte)
destlenmaximal length allowed for string - NEVER -1.
allow_bad_convdetermines if a "best effort" conversion is acceptable (never returns errors)
Returns
the number of bytes occupied in the destination

Ensure the srclen contains the terminating zero.

This function has been hand-tuned to provide a fast path. Don't change unless you really know what you are doing. JRA.

void init_iconv_ntlmssp ( void  )

Initialize iconv conversion descriptors.

This is called the first time it is needed, and also called again every time the configuration is reloaded, because the charset or codepage might have changed.

void init_valid_table_ntlmssp ( void  )
void lazy_initialize_conv_ntlmssp ( void  )
char lp_failed_convert_char_ntlmssp ( void  )
size_t push_ascii_ntlmssp ( void *  dest,
const char *  src,
size_t  dest_len,
int  flags 
)

Copy a string from a char* unix src to a dos codepage string destination.

Returns
the number of bytes occupied by the string in the destination.
Parameters
flagscan include
STR_TERMINATE
means include the null termination
STR_UPPER
means uppercase in the destination
dest_lenthe maximum length in bytes allowed in the destination. If dest_len is -1 then no maximum is used.
size_t strlen_w_ntlmssp ( const uint16 src)
_PUBLIC_ void strupper_m_ntlmssp ( char *  s)

Convert a string to UPPER case.