libssh 0.4.8
Functions

SSH Strings

string manipulations More...

Functions

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

Detailed Description

string manipulations


Function Documentation

void string_burn ( struct ssh_string_struct *  s)

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

Parameters:
sstring to burn

References string_len().

Referenced by publickey_from_privatekey(), and ssh_userauth_password().

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

Copy a string, return a newly allocated string.

The caller has to free the string.

Parameters:
sString to copy.
Returns:
Newly allocated copy of the string, NULL on error.
void* string_data ( struct ssh_string_struct *  s)

Get the payload of the string.

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

Referenced by publickey_from_privatekey().

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

Fill a string with given data.

The string should be big enough.

Parameters:
sAn allocated string to fill with data.
dataThe data to fill the string with.
lenSize 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 ssh_string_struct *  s)
struct ssh_string_struct* string_from_char ( const char *  what) [read]
size_t string_len ( struct ssh_string_struct *  s)

returns the size of a SSH string

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

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

struct ssh_string_struct* string_new ( size_t  size) [read]

Creates a new SSH String object.

Parameters:
sizesize 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 ssh_string_struct *  s)

convert a SSH string to a C nul-terminated string

Parameters:
sthe 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().