SSH Strings

string manipulations More...


Functions

void string_burn (struct string_struct *s)
 destroy data in a string so it couldn't appear in a core dump
struct string_struct * string_copy (struct string_struct *s)
 Copy a string, return a newly allocated string.
void * string_data (struct string_struct *s)
 Get the payload of the string.
int string_fill (struct string_struct *s, const void *data, size_t len)
 Fill a string with given data.
void string_free (struct string_struct *s)
 deallocate a STRING object
struct string_struct * string_from_char (const char *what)
 Creates a ssh stream using a C string.
size_t string_len (struct string_struct *s)
 returns the size of a SSH string
struct string_struct * string_new (size_t size)
 Creates a new SSH String object.
char * string_to_char (struct string_struct *s)
 convert a SSH string to a C nul-terminated string


Detailed Description

string manipulations

Function Documentation

void string_burn ( struct string_struct *  s  ) 

destroy data in a string so it couldn't appear in a core dump

Parameters:
s string to burn

References string_len().

Referenced by publickey_from_privatekey(), and ssh_userauth_password().

struct string_struct* string_copy ( struct string_struct *  s  )  [read]

Copy a string, return a newly allocated string.

The caller has to free the string.

Parameters:
s String to copy.
Returns:
Newly allocated copy of the string, NULL on error.

void* string_data ( struct string_struct *  s  ) 

Get the payload of the string.

Parameters:
s The string to get the data from.
Returns:
Return the data of the string or NULL on error.

int string_fill ( struct string_struct *  s,
const void *  data,
size_t  len 
)

Fill a string with given data.

The string should be big enough.

Parameters:
s An allocated string to fill with data.
data The data to fill the string with.
len Size of data.
Returns:
0 on success, < 0 on error.

Referenced by publickey_from_file(), publickey_from_privatekey(), and publickey_to_string().

void string_free ( struct string_struct *  s  ) 

struct string_struct* string_from_char ( const char *  what  )  [read]

Creates a ssh stream using a C string.

Parameters:
what source 0-terminated C string
Returns:
the newly allocated string.
Warning:
The nul byte is not copied nor counted in the ouput string.

Referenced by channel_open_forward(), channel_request_env(), channel_request_exec(), channel_request_pty_size(), channel_request_subsystem(), publickey_to_string(), ssh_disconnect(), ssh_userauth_agent_pubkey(), ssh_userauth_none(), ssh_userauth_offer_pubkey(), ssh_userauth_password(), and ssh_userauth_pubkey().

size_t string_len ( struct string_struct *  s  ) 

returns the size of a SSH string

Parameters:
str the input SSH string
Returns:
size of the content of str, 0 on error

Referenced by publickey_from_privatekey(), ssh_get_pubkey_hash(), ssh_write_knownhost(), and string_burn().

struct string_struct* string_new ( size_t  size  )  [read]

Creates a new SSH String object.

Parameters:
size size of the string
Returns:
the newly allocated string

Referenced by publickey_from_file(), publickey_from_privatekey(), and publickey_to_string().

char* string_to_char ( struct string_struct *  s  ) 

convert a SSH string to a C nul-terminated string

Parameters:
str the input SSH string
Returns:
a malloc'ed string pointer.
Warning:
If the input SSH string contains zeroes, some parts of the output string may not be readable with regular libc functions.

Referenced by ssh_get_issue_banner().


doxygen