1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

Fix multiple spelling and grammar mistakes

Signed-off-by: Junda Ai <aijunda29@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Junda Ai
2022-04-27 11:44:48 -07:00
committed by Jakub Jelen
parent 3084b2bc41
commit 41e2d17119
32 changed files with 112 additions and 111 deletions

View File

@@ -58,7 +58,7 @@
/** /**
* @internal * @internal
* *
* @brief Ask access to the ssh-userauth service. * @brief Ask for access to the ssh-userauth service.
* *
* @param[in] session The SSH session handle. * @param[in] session The SSH session handle.
* *
@@ -1873,7 +1873,7 @@ int ssh_userauth_kbdint_getnanswers(ssh_session session) {
} }
/** /**
* @brief Get the answer for a question from a message block. * @brief Get the answer to a question from a message block.
* *
* @param[in] session The ssh session to use. * @param[in] session The ssh session to use.
* *

View File

@@ -339,7 +339,7 @@ static int ssh_bind_poll_callback(ssh_poll_handle sshpoll,
} }
/** @internal /** @internal
* @brief returns the current poll handle, or create it * @brief returns the current poll handle, or creates it
* @param sshbind the ssh_bind object * @param sshbind the ssh_bind object
* @returns a ssh_poll handle suitable for operation * @returns a ssh_poll handle suitable for operation
*/ */

View File

@@ -688,7 +688,7 @@ int ssh_bind_config_parse_string(ssh_bind bind, const char *input)
line_start = c; line_start = c;
c = strchr(line_start, '\n'); c = strchr(line_start, '\n');
if (c == NULL) { if (c == NULL) {
/* if there is no newline in the end of the string */ /* if there is no newline at the end of the string */
c = strchr(line_start, '\0'); c = strchr(line_start, '\0');
} }
if (c == NULL) { if (c == NULL) {

View File

@@ -129,7 +129,7 @@ struct ssh_buffer_struct *ssh_buffer_new(void)
/* /*
* Always preallocate 64 bytes. * Always preallocate 64 bytes.
* *
* -1 for ralloc_buffer magic. * -1 for realloc_buffer magic.
*/ */
rc = ssh_buffer_allocate_size(buf, 64 - 1); rc = ssh_buffer_allocate_size(buf, 64 - 1);
if (rc != 0) { if (rc != 0) {
@@ -693,7 +693,7 @@ uint32_t ssh_buffer_get_data(struct ssh_buffer_struct *buffer, void *data, uint3
/** /**
* @internal * @internal
* *
* @brief Get a 8 bits unsigned int out of the buffer and adjusts the read * @brief Get a 8 bits unsigned int out of the buffer and adjust the read
* pointer. * pointer.
* *
* @param[in] buffer The buffer to read. * @param[in] buffer The buffer to read.
@@ -757,7 +757,7 @@ int ssh_buffer_validate_length(struct ssh_buffer_struct *buffer, size_t len)
/** /**
* @internal * @internal
* *
* @brief Get a SSH String out of the buffer and adjusts the read pointer. * @brief Get an SSH String out of the buffer and adjust the read pointer.
* *
* @param[in] buffer The buffer to read. * @param[in] buffer The buffer to read.
* *

View File

@@ -65,7 +65,7 @@ static int chacha20_set_encrypt_key(struct ssh_cipher_struct *cipher,
/** /**
* @internal * @internal
* *
* @brief encrypts an outgoing packet with chacha20 and authenticate it * @brief encrypts an outgoing packet with chacha20 and authenticates it
* with poly1305. * with poly1305.
*/ */
static void chacha20_poly1305_aead_encrypt(struct ssh_cipher_struct *cipher, static void chacha20_poly1305_aead_encrypt(struct ssh_cipher_struct *cipher,

View File

@@ -370,7 +370,7 @@ end:
if (channel->state == SSH_CHANNEL_STATE_OPEN) { if (channel->state == SSH_CHANNEL_STATE_OPEN) {
err = SSH_OK; err = SSH_OK;
} else if (err != SSH_AGAIN) { } else if (err != SSH_AGAIN) {
/* Messages were handled correctly, but he channel state is invalid */ /* Messages were handled correctly, but the channel state is invalid */
err = SSH_ERROR; err = SSH_ERROR;
} }
@@ -397,7 +397,7 @@ ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id) {
/** /**
* @internal * @internal
* @brief grows the local window and send a packet to the other party * @brief grows the local window and sends a packet to the other party
* @param session SSH session * @param session SSH session
* @param channel SSH channel * @param channel SSH channel
* @param minimumsize The minimum acceptable size for the new window. * @param minimumsize The minimum acceptable size for the new window.
@@ -1203,7 +1203,7 @@ void ssh_channel_free(ssh_channel channel)
channel->flags |= SSH_CHANNEL_FLAG_FREED_LOCAL; channel->flags |= SSH_CHANNEL_FLAG_FREED_LOCAL;
/* The idea behind the flags is the following : it is well possible /* The idea behind the flags is the following : it is well possible
* that a client closes a channel that stills exists on the server side. * that a client closes a channel that still exists on the server side.
* We definitively close the channel when we receive a close message *and* * We definitively close the channel when we receive a close message *and*
* the user closed it. * the user closed it.
*/ */
@@ -1566,7 +1566,7 @@ error:
/** /**
* @brief Get the remote window size. * @brief Get the remote window size.
* *
* This is the maximum amounts of bytes the remote side expects us to send * This is the maximum amount of bytes the remote side expects us to send
* before growing the window again. * before growing the window again.
* *
* @param[in] channel The channel to query. * @param[in] channel The channel to query.
@@ -1826,7 +1826,7 @@ error:
/** /**
* @brief Request a pty with a specific type and size. * @brief Request a pty with a specific type and size.
* *
* @param[in] channel The channel to sent the request. * @param[in] channel The channel to send the request.
* *
* @param[in] terminal The terminal type ("vt100, xterm,..."). * @param[in] terminal The terminal type ("vt100, xterm,...").
* *
@@ -1918,8 +1918,8 @@ int ssh_channel_request_pty(ssh_channel channel) {
* @return SSH_OK on success, SSH_ERROR if an error occurred. * @return SSH_OK on success, SSH_ERROR if an error occurred.
* *
* @warning Do not call it from a signal handler if you are not sure any other * @warning Do not call it from a signal handler if you are not sure any other
* libssh function using the same channel/session is running at same * libssh function using the same channel/session is running at the
* time (not 100% threadsafe). * same time (not 100% threadsafe).
*/ */
int ssh_channel_change_pty_size(ssh_channel channel, int cols, int rows) { int ssh_channel_change_pty_size(ssh_channel channel, int cols, int rows) {
ssh_session session = channel->session; ssh_session session = channel->session;
@@ -2062,7 +2062,7 @@ static char *generate_cookie(void) {
* @brief Sends the "x11-req" channel request over an existing session channel. * @brief Sends the "x11-req" channel request over an existing session channel.
* *
* This will enable redirecting the display of the remote X11 applications to * This will enable redirecting the display of the remote X11 applications to
* local X server over an secure tunnel. * local X server over a secure tunnel.
* *
* @param[in] channel An existing session channel where the remote X11 * @param[in] channel An existing session channel where the remote X11
* applications are going to be executed. * applications are going to be executed.
@@ -2858,7 +2858,7 @@ static int ssh_channel_read_termination(void *s){
return 0; return 0;
} }
/* TODO FIXME Fix the blocking behaviours */ /* TODO: FIXME Fix the blocking behaviours */
/** /**
* @brief Reads data from a channel. * @brief Reads data from a channel.

View File

@@ -1238,7 +1238,7 @@ int ssh_config_parse_string(ssh_session session, const char *input)
line_start = c; line_start = c;
c = strchr(line_start, '\n'); c = strchr(line_start, '\n');
if (c == NULL) { if (c == NULL) {
/* if there is no newline in the end of the string */ /* if there is no newline at the end of the string */
c = strchr(line_start, '\0'); c = strchr(line_start, '\0');
} }
if (c == NULL) { if (c == NULL) {

View File

@@ -289,14 +289,14 @@ static int ssh_select_cb (socket_t fd, int revents, void *userdata)
/** /**
* @brief A wrapper for the select syscall * @brief A wrapper for the select syscall
* *
* This functions acts more or less like the select(2) syscall.\n * This function acts more or less like the select(2) syscall.\n
* There is no support for writing or exceptions.\n * There is no support for writing or exceptions.\n
* *
* @param[in] channels Arrays of channels pointers terminated by a NULL. * @param[in] channels Arrays of channels pointers terminated by a NULL.
* It is never rewritten. * It is never rewritten.
* *
* @param[out] outchannels Arrays of same size that "channels", there is no need * @param[out] outchannels Arrays of the same size as "channels", there is no
* to initialize it. * need to initialize it.
* *
* @param[in] maxfd Maximum +1 file descriptor from readfds. * @param[in] maxfd Maximum +1 file descriptor from readfds.
* *

View File

@@ -216,7 +216,7 @@ static void ssh_connector_except_channel(ssh_connector connector,
/** /**
* @internal * @internal
* *
* @brief Reset the poll events to be followed for each file descriptors. * @brief Reset the poll events to be followed for each file descriptor.
*/ */
static void ssh_connector_reset_pollevents(ssh_connector connector) static void ssh_connector_reset_pollevents(ssh_connector connector)
{ {

View File

@@ -640,7 +640,7 @@ ssh_key ssh_dh_get_current_server_publickey(ssh_session session)
return session->current_crypto->server_pubkey; return session->current_crypto->server_pubkey;
} }
/* Caller need to free the blob */ /* Caller needs to free the blob */
int ssh_dh_get_current_server_publickey_blob(ssh_session session, int ssh_dh_get_current_server_publickey_blob(ssh_session session,
ssh_string *pubkey_blob) ssh_string *pubkey_blob)
{ {
@@ -654,7 +654,7 @@ ssh_key ssh_dh_get_next_server_publickey(ssh_session session)
return session->next_crypto->server_pubkey; return session->next_crypto->server_pubkey;
} }
/* Caller need to free the blob */ /* Caller needs to free the blob */
int ssh_dh_get_next_server_publickey_blob(ssh_session session, int ssh_dh_get_next_server_publickey_blob(ssh_session session,
ssh_string *pubkey_blob) ssh_string *pubkey_blob)
{ {
@@ -699,7 +699,7 @@ static char *ssh_get_b64_unpadded(const unsigned char *hash, size_t len)
* @brief Get a hash as a human-readable hex- or base64-string. * @brief Get a hash as a human-readable hex- or base64-string.
* *
* This gets an allocated fingerprint hash. If it is a SHA sum, it will * This gets an allocated fingerprint hash. If it is a SHA sum, it will
* return an unpadded base64 strings. If it is a MD5 sum, it will return hex * return an unpadded base64 string. If it is a MD5 sum, it will return a hex
* string. Either way, the output is prepended by the hash-type. * string. Either way, the output is prepended by the hash-type.
* *
* @warning Do NOT use MD5 or SHA1! Those hash functions are being deprecated. * @warning Do NOT use MD5 or SHA1! Those hash functions are being deprecated.

View File

@@ -142,7 +142,7 @@ const char *ssh_get_error(void *error) {
* SSH_FATAL A fatal error occurred. This could be an unexpected * SSH_FATAL A fatal error occurred. This could be an unexpected
* disconnection\n * disconnection\n
* *
* Other error codes are internal but can be considered same than * Other error codes are internal but can be considered the same as
* SSH_FATAL. * SSH_FATAL.
*/ */
int ssh_get_error_code(void *error) { int ssh_get_error_code(void *error) {

View File

@@ -581,7 +581,7 @@ ssh_gssapi_creds ssh_gssapi_get_creds(ssh_session session){
#endif /* SERVER */ #endif /* SERVER */
/** /**
* @brief Set the forwadable ticket to be given to the server for authentication. * @brief Set the forwardable ticket to be given to the server for authentication.
* Unlike ssh_gssapi_get_creds() this is called on the client side of an ssh * Unlike ssh_gssapi_get_creds() this is called on the client side of an ssh
* connection. * connection.
* *

View File

@@ -104,7 +104,7 @@ _ret:
/** /**
* @brief Initialize global cryptographic data structures. * @brief Initialize global cryptographic data structures.
* *
* This functions is automatically called when the library is loaded. * This function is automatically called when the library is loaded.
* *
*/ */
void libssh_constructor(void) void libssh_constructor(void)
@@ -127,7 +127,7 @@ void libssh_constructor(void)
* The libssh library is implementing the SSH protocols and some of its * The libssh library is implementing the SSH protocols and some of its
* extensions. This group of functions is mostly used to implement an SSH * extensions. This group of functions is mostly used to implement an SSH
* client. * client.
* Some function are needed to implement an SSH server too. * Some functions are needed to implement an SSH server too.
* *
* @{ * @{
*/ */
@@ -136,8 +136,8 @@ void libssh_constructor(void)
* @brief Initialize global cryptographic data structures. * @brief Initialize global cryptographic data structures.
* *
* Since version 0.8.0, when libssh is dynamically linked, it is not necessary * Since version 0.8.0, when libssh is dynamically linked, it is not necessary
* to call this function on systems which are fully supported with regards to * to call this function on systems that fully support threading (that is,
* threading (that is, system with pthreads available). * systems with pthreads available).
* *
* If libssh is statically linked, it is necessary to explicitly call ssh_init() * If libssh is statically linked, it is necessary to explicitly call ssh_init()
* before calling any other provided API, and it is necessary to explicitly call * before calling any other provided API, and it is necessary to explicitly call

View File

@@ -39,7 +39,7 @@
/* The following implements the SSHKDF for crypto backend that /* The following implements the SSHKDF for crypto backend that
* do not have a native implementations */ * do not have a native implementation */
struct ssh_mac_ctx_struct { struct ssh_mac_ctx_struct {
enum ssh_kdf_digest digest_type; enum ssh_kdf_digest digest_type;
union { union {

View File

@@ -965,13 +965,13 @@ char *ssh_keep_known_algos(enum ssh_kex_types_e algo, const char *list)
/** /**
* @internal * @internal
* *
* @brief Return a new allocated string containing only the FIPS allowed * @brief Return a newly allocated string containing only the FIPS allowed
* algorithms from the list. * algorithms from the list.
* *
* @param[in] algo The type of the methods to filter * @param[in] algo The type of the methods to filter
* @param[in] list The list to be filtered * @param[in] list The list to be filtered
* *
* @return A new allocated list containing only the FIPS allowed algorithms from * @return A newly allocated list containing only the FIPS allowed algorithms from
* the list; NULL in case of error. * the list; NULL in case of error.
*/ */
char *ssh_keep_fips_algos(enum ssh_kex_types_e algo, const char *list) char *ssh_keep_fips_algos(enum ssh_kex_types_e algo, const char *list)

View File

@@ -600,7 +600,7 @@ char *ssh_known_hosts_get_algorithms_names(ssh_session session)
/** /**
* @brief Parse a line from a known_hosts entry into a structure * @brief Parse a line from a known_hosts entry into a structure
* *
* This parses an known_hosts entry into a structure with the key in a libssh * This parses a known_hosts entry into a structure with the key in a libssh
* consumeable form. You can use the PKI key function to further work with it. * consumeable form. You can use the PKI key function to further work with it.
* *
* @param[in] hostname The hostname to match the line to * @param[in] hostname The hostname to match the line to
@@ -608,7 +608,7 @@ char *ssh_known_hosts_get_algorithms_names(ssh_session session)
* @param[in] line The line to compare and parse if we have a hostname * @param[in] line The line to compare and parse if we have a hostname
* match. * match.
* *
* @param[in] entry A pointer to store the the allocated known_hosts * @param[in] entry A pointer to store the allocated known_hosts
* entry structure. The user needs to free the memory * entry structure. The user needs to free the memory
* using SSH_KNOWNHOSTS_ENTRY_FREE(). * using SSH_KNOWNHOSTS_ENTRY_FREE().
* *
@@ -662,7 +662,7 @@ int ssh_known_hosts_parse_line(const char *hostname,
if (q[0] == '[' && hostname[0] != '[') { if (q[0] == '[' && hostname[0] != '[') {
/* Corner case: We have standard port so we do not have /* Corner case: We have standard port so we do not have
* hostname in square braces. But the patern is enclosed * hostname in square braces. But the pattern is enclosed
* in braces with, possibly standard or wildcard, port. * in braces with, possibly standard or wildcard, port.
* We need to test against [host]:port pair here. * We need to test against [host]:port pair here.
*/ */
@@ -775,12 +775,12 @@ out:
} }
/** /**
* @brief Check if the set hostname and port matches an entry in known_hosts. * @brief Check if the set hostname and port match an entry in known_hosts.
* *
* This check if the set hostname and port has an entry in the known_hosts file. * This check if the set hostname and port have an entry in the known_hosts file.
* You need to set at least the hostname using ssh_options_set(). * You need to set at least the hostname using ssh_options_set().
* *
* @param[in] session The session with with the values set to check. * @param[in] session The session with the values set to check.
* *
* @return A ssh_known_hosts_e return value. * @return A ssh_known_hosts_e return value.
*/ */
@@ -893,11 +893,11 @@ enum ssh_known_hosts_e ssh_session_has_known_hosts_entry(ssh_session session)
* *
* @param[in] session The session with information to export. * @param[in] session The session with information to export.
* *
* @param[in] pentry_string A pointer to a string to store the alloocated * @param[in] pentry_string A pointer to a string to store the allocated
* line of the entry. The user must free it using * line of the entry. The user must free it using
* ssh_string_free_char(). * ssh_string_free_char().
* *
* @return SSH_OK on succcess, SSH_ERROR otherwise. * @return SSH_OK on success, SSH_ERROR otherwise.
*/ */
int ssh_session_export_known_hosts_entry(ssh_session session, int ssh_session_export_known_hosts_entry(ssh_session session,
char **pentry_string) char **pentry_string)
@@ -962,7 +962,7 @@ int ssh_session_export_known_hosts_entry(ssh_session session,
} }
/** /**
* @brief Add the current connected server to the user known_hosts file. * @brief Adds the currently connected server to the user known_hosts file.
* *
* This adds the currently connected server to the known_hosts file by * This adds the currently connected server to the known_hosts file by
* appending a new line at the end. The global known_hosts file is considered * appending a new line at the end. The global known_hosts file is considered
@@ -1113,7 +1113,7 @@ ssh_known_hosts_check_server_key(const char *hosts_entry,
} }
/** /**
* @brief Get the known_hosts entry for the current connected session. * @brief Get the known_hosts entry for the currently connected session.
* *
* @param[in] session The session to validate. * @param[in] session The session to validate.
* *
@@ -1132,7 +1132,7 @@ ssh_known_hosts_check_server_key(const char *hosts_entry,
* SSH_KNOWN_HOSTS_NOT_FOUND: The known host file does not exist. The * SSH_KNOWN_HOSTS_NOT_FOUND: The known host file does not exist. The
* host is thus unknown. File will be * host is thus unknown. File will be
* created if host key is accepted.\n * created if host key is accepted.\n
* SSH_KNOWN_HOSTS_ERROR: There had been an eror checking the host. * SSH_KNOWN_HOSTS_ERROR: There had been an error checking the host.
* *
* @see ssh_knownhosts_entry_free() * @see ssh_knownhosts_entry_free()
*/ */

View File

@@ -20,7 +20,7 @@
*/ */
/** functions in that file are wrappers to the newly named functions. All /** functions in that file are wrappers to the newly named functions. All
* of them are depreciated, but these wrapper will avoid breaking backward * of them are depreciated, but these wrappers will avoid breaking backward
* compatibility * compatibility
*/ */

View File

@@ -434,7 +434,7 @@ aes_gcm_encrypt(struct ssh_cipher_struct *cipher,
err = gcry_cipher_setiv(cipher->key[0], err = gcry_cipher_setiv(cipher->key[0],
cipher->last_iv, cipher->last_iv,
AES_GCM_IVLEN); AES_GCM_IVLEN);
/* This actualy does not increment the packet counter for the /* This actually does not increment the packet counter for the
* current encryption operation, but for the next one. The first * current encryption operation, but for the next one. The first
* operation needs to be completed with the derived IV. * operation needs to be completed with the derived IV.
* *

View File

@@ -54,7 +54,7 @@
* This file contains the message parsing utilities for client and server * This file contains the message parsing utilities for client and server
* programs using libssh. * programs using libssh.
* *
* On the server the the main loop of the program will call * On the server the main loop of the program will call
* ssh_message_get(session) to get messages as they come. They are not 1-1 with * ssh_message_get(session) to get messages as they come. They are not 1-1 with
* the protocol messages. Then, the user will know what kind of a message it is * the protocol messages. Then, the user will know what kind of a message it is
* and use the appropriate functions to handle it (or use the default handlers * and use the appropriate functions to handle it (or use the default handlers
@@ -79,7 +79,7 @@ static ssh_message ssh_message_new(ssh_session session)
#ifndef WITH_SERVER #ifndef WITH_SERVER
/* Reduced version of the reply default that only reply with /* Reduced version of the reply default that only replies with
* SSH_MSG_UNIMPLEMENTED * SSH_MSG_UNIMPLEMENTED
*/ */
static int ssh_message_reply_default(ssh_message msg) { static int ssh_message_reply_default(ssh_message msg) {
@@ -1248,7 +1248,7 @@ end:
* *
* @param[in] chan The channel the request is made on. * @param[in] chan The channel the request is made on.
* *
* @returns SSH_OK on success, SSH_ERROR if an error occured. * @returns SSH_OK on success, SSH_ERROR if an error occurred.
*/ */
int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_channel chan) { int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_channel chan) {
ssh_session session; ssh_session session;
@@ -1339,7 +1339,7 @@ ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg) {
* *
* @param[in] want_reply The want_reply field from the request. * @param[in] want_reply The want_reply field from the request.
* *
* @returns SSH_OK on success, SSH_ERROR if an error occured. * @returns SSH_OK on success, SSH_ERROR if an error occurred.
*/ */
int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet, int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet,
const char *request, uint8_t want_reply) { const char *request, uint8_t want_reply) {

View File

@@ -455,7 +455,7 @@ void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len) {
* " 00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................" * " 00000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................"
* *
* The value for each byte as corresponding ASCII character is printed at the * The value for each byte as corresponding ASCII character is printed at the
* end if the value is printable. Otherwise it is replace with '.'. * end if the value is printable. Otherwise, it is replaced with '.'.
* *
* @param[in] descr A description for the content to be logged * @param[in] descr A description for the content to be logged
* @param[in] what The buffer to be logged * @param[in] what The buffer to be logged
@@ -840,7 +840,7 @@ const void *_ssh_list_pop_head(struct ssh_list *list){
* *
* @return The dirname of path or NULL if we can't allocate memory. * @return The dirname of path or NULL if we can't allocate memory.
* If path does not contain a slash, c_dirname() returns * If path does not contain a slash, c_dirname() returns
* the string ".". If path is the string "/", it returns * the string ".". If path is a string "/", it returns
* the string "/". If path is NULL or an empty string, * the string "/". If path is NULL or an empty string,
* "." is returned. * "." is returned.
*/ */
@@ -895,7 +895,7 @@ char *ssh_dirname (const char *path) {
* @param[in] path The path to parse. * @param[in] path The path to parse.
* *
* @return The filename of path or NULL if we can't allocate * @return The filename of path or NULL if we can't allocate
* memory. If path is a the string "/", basename returns * memory. If path is the string "/", basename returns
* the string "/". If path is NULL or an empty string, * the string "/". If path is NULL or an empty string,
* "." is returned. * "." is returned.
*/ */
@@ -1653,13 +1653,13 @@ int ssh_quote_file_name(const char *file_name, char *buf, size_t buf_len)
*dst++ = '\\'; *dst++ = '\\';
break; break;
case SINGLE_QUOTE: case SINGLE_QUOTE:
/* Close the current quoted string and replace '!' for unquoted /* Close the currently quoted string and replace '!' for unquoted
* "\!" */ * "\!" */
*dst++ = '\''; *dst++ = '\'';
*dst++ = '\\'; *dst++ = '\\';
break; break;
case DOUBLE_QUOTE: case DOUBLE_QUOTE:
/* Close current quoted string and replace "!" for unquoted /* Close currently quoted string and replace "!" for unquoted
* "\!" */ * "\!" */
*dst++ = '"'; *dst++ = '"';
*dst++ = '\\'; *dst++ = '\\';
@@ -1835,11 +1835,12 @@ err:
/** /**
* @internal * @internal
* *
* @brief Finds the first occurence of a patterm in a string and replaces it. * @brief Finds the first occurrence of a pattern in a string and replaces it.
* *
* @param[in] src Source string containing the patern to be replaced. * @param[in] src Source string containing the pattern to be replaced.
* @param[in] pattern Pattern to be replaced in the source string. * @param[in] pattern Pattern to be replaced in the source string.
* Note: this function replaces the first occurence of pattern only. * Note: this function replaces the first occurrence of
* pattern only.
* @param[in] replace String to be replaced is stored in replace. * @param[in] replace String to be replaced is stored in replace.
* *
* @returns src_replaced a pointer that points to the replaced string. * @returns src_replaced a pointer that points to the replaced string.

View File

@@ -58,7 +58,7 @@
* @param dest A pointer to store the allocated session with duplicated * @param dest A pointer to store the allocated session with duplicated
* options. You have to free the memory. * options. You have to free the memory.
* *
* @returns 0 on sucess, -1 on error with errno set. * @returns 0 on success, -1 on error with errno set.
* *
* @see ssh_session_connect() * @see ssh_session_connect()
*/ */
@@ -340,7 +340,7 @@ int ssh_options_set_algo(ssh_session session,
* - SSH_LOG_NOLOG: No logging * - SSH_LOG_NOLOG: No logging
* - SSH_LOG_WARNING: Only warnings * - SSH_LOG_WARNING: Only warnings
* - SSH_LOG_PROTOCOL: High level protocol information * - SSH_LOG_PROTOCOL: High level protocol information
* - SSH_LOG_PACKET: Lower level protocol infomations, packet level * - SSH_LOG_PACKET: Lower level protocol information, packet level
* - SSH_LOG_FUNCTIONS: Every function path * - SSH_LOG_FUNCTIONS: Every function path
* *
* - SSH_OPTIONS_LOG_VERBOSITY_STR: * - SSH_OPTIONS_LOG_VERBOSITY_STR:
@@ -1070,7 +1070,7 @@ int ssh_options_get_port(ssh_session session, unsigned int* port_target) {
/** /**
* @brief This function can get ssh options, it does not support all options provided for * @brief This function can get ssh options, it does not support all options provided for
* ssh options set, but mostly those which a user-space program may care about having * ssh options set, but mostly those which a user-space program may care about having
* trusted the ssh driver to infer these values from underlaying configuration files. * trusted the ssh driver to infer these values from underlying configuration files.
* It operates only on those SSH_OPTIONS_* which return char*. If you wish to receive * It operates only on those SSH_OPTIONS_* which return char*. If you wish to receive
* the port then please use ssh_options_get_port() which returns an unsigned int. * the port then please use ssh_options_get_port() which returns an unsigned int.
* *
@@ -1175,10 +1175,10 @@ int ssh_options_get(ssh_session session, enum ssh_options_e type, char** value)
* This is a helper for your application to generate the appropriate * This is a helper for your application to generate the appropriate
* options from the command line arguments.\n * options from the command line arguments.\n
* The argv array and argc value are changed so that the parsed * The argv array and argc value are changed so that the parsed
* arguments wont appear anymore in them.\n * arguments won't appear anymore in them.\n
* The single arguments (without switches) are not parsed. thus, * The single arguments (without switches) are not parsed. thus,
* myssh -l user localhost\n * myssh -l user localhost\n
* The command wont set the hostname value of options to localhost. * The command won't set the hostname value of options to localhost.
* *
* @param session The session to configure. * @param session The session to configure.
* *
@@ -1555,7 +1555,7 @@ static int ssh_bind_set_algo(ssh_bind sshbind,
* *
* - SSH_BIND_OPTIONS_HOSTKEY: * - SSH_BIND_OPTIONS_HOSTKEY:
* Set the path to an ssh host key, regardless * Set the path to an ssh host key, regardless
* of type. Only one key from per key type * of type. Only one key from each key type
* (RSA, DSA, ECDSA) is allowed in an ssh_bind * (RSA, DSA, ECDSA) is allowed in an ssh_bind
* at a time, and later calls to this function * at a time, and later calls to this function
* with this option for the same key type will * with this option for the same key type will
@@ -1580,7 +1580,7 @@ static int ssh_bind_set_algo(ssh_bind sshbind,
* - SSH_LOG_NOLOG: No logging * - SSH_LOG_NOLOG: No logging
* - SSH_LOG_WARNING: Only warnings * - SSH_LOG_WARNING: Only warnings
* - SSH_LOG_PROTOCOL: High level protocol information * - SSH_LOG_PROTOCOL: High level protocol information
* - SSH_LOG_PACKET: Lower level protocol infomations, packet level * - SSH_LOG_PACKET: Lower level protocol information, packet level
* - SSH_LOG_FUNCTIONS: Every function path * - SSH_LOG_FUNCTIONS: Every function path
* *
* - SSH_BIND_OPTIONS_LOG_VERBOSITY_STR: * - SSH_BIND_OPTIONS_LOG_VERBOSITY_STR:
@@ -2132,7 +2132,7 @@ static char *ssh_bind_options_expand_escape(ssh_bind sshbind, const char *s)
* @param sshbind SSH bind handle * @param sshbind SSH bind handle
* *
* @param filename The options file to use; if NULL only the global * @param filename The options file to use; if NULL only the global
* configuration is parsed and applied (if it haven't been * configuration is parsed and applied (if it hasn't been
* processed before). * processed before).
* *
* @return 0 on success, < 0 on error. * @return 0 on success, < 0 on error.

View File

@@ -103,7 +103,7 @@ struct ssh_pcap_context_struct {
ssh_session session; ssh_session session;
ssh_pcap_file file; ssh_pcap_file file;
int connected; int connected;
/* All of these information are useful to generate /* All of this information is useful to generate
* the dummy IP and TCP packets * the dummy IP and TCP packets
*/ */
uint32_t ipsource; uint32_t ipsource;
@@ -198,7 +198,7 @@ error:
} }
/** /**
* @brief opens a new pcap file and create header * @brief opens a new pcap file and creates header
*/ */
int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename){ int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename){
ssh_buffer header; ssh_buffer header;
@@ -506,7 +506,7 @@ error:
/** @brief sets the pcap file used to trace the session /** @brief sets the pcap file used to trace the session
* @param current session * @param current session
* @param pcap an handler to a pcap file. A pcap file may be used in several * @param pcap a handler to a pcap file. A pcap file may be used in several
* sessions. * sessions.
* @returns SSH_ERROR in case of error, SSH_OK otherwise. * @returns SSH_ERROR in case of error, SSH_OK otherwise.
*/ */

View File

@@ -764,7 +764,7 @@ void ssh_signature_free(ssh_signature sig)
} }
/** /**
* @brief import a base64 formated key from a memory c-string * @brief import a base64 formatted key from a memory c-string
* *
* @param[in] b64_key The c-string holding the base64 encoded key * @param[in] b64_key The c-string holding the base64 encoded key
* *
@@ -1557,7 +1557,7 @@ fail:
} }
/** /**
* @brief Import a base64 formated public key from a memory c-string. * @brief Import a base64 formatted public key from a memory c-string.
* *
* @param[in] b64_key The base64 key to format. * @param[in] b64_key The base64 key to format.
* *
@@ -1835,7 +1835,7 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
} }
/** /**
* @brief Import a base64 formated certificate from a memory c-string. * @brief Import a base64 formatted certificate from a memory c-string.
* *
* @param[in] b64_cert The base64 cert to format. * @param[in] b64_cert The base64 cert to format.
* *

View File

@@ -2148,7 +2148,7 @@ error:
/** /**
* @internal * @internal
* *
* @brief Sign the given input data. The digest of to be signed is calculated * @brief Sign the given input data. The digest to be signed is calculated
* internally as necessary. * internally as necessary.
* *
* @param[in] privkey The private key to be used for signing. * @param[in] privkey The private key to be used for signing.

View File

@@ -51,7 +51,7 @@
* *
* It's based on poll objects, each of which store a socket, its events and a * It's based on poll objects, each of which store a socket, its events and a
* callback, which gets called whenever an event is set. The poll objects are * callback, which gets called whenever an event is set. The poll objects are
* attached to a poll context, which should be allocated on per thread basis. * attached to a poll context, which should be allocated on a per thread basis.
* *
* Polling the poll context will poll all the attached poll objects and call * Polling the poll context will poll all the attached poll objects and call
* their callbacks (handlers) if any of the socket events are set. This should * their callbacks (handlers) if any of the socket events are set. This should
@@ -210,8 +210,8 @@ static short bsd_socket_compute_revents(int fd, short events)
* poll implementation. * poll implementation.
* *
* Keep in mind that select is terribly inefficient. The interface is simply not * Keep in mind that select is terribly inefficient. The interface is simply not
* meant to be used with maximum descriptor value greater, say, 32 or so. With * meant to be used with maximum descriptor value greater than, say, 32 or so.
* a value as high as 1024 on Linux you'll pay dearly in every single call. * With a value as high as 1024 on Linux you'll pay dearly in every single call.
* poll() will be orders of magnitude faster. * poll() will be orders of magnitude faster.
*/ */
static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout) static int bsd_poll(ssh_pollfd_t *fds, nfds_t nfds, int timeout)
@@ -646,7 +646,7 @@ void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p) {
* @brief Poll all the sockets associated through a poll object with a * @brief Poll all the sockets associated through a poll object with a
* poll context. If any of the events are set after the poll, the * poll context. If any of the events are set after the poll, the
* call back function of the socket will be called. * call back function of the socket will be called.
* This function should be called once within the programs main loop. * This function should be called once within the program's main loop.
* *
* @param ctx Pointer to an already allocated poll context. * @param ctx Pointer to an already allocated poll context.
* @param timeout An upper limit on the time for which ssh_poll_ctx() will * @param timeout An upper limit on the time for which ssh_poll_ctx() will
@@ -655,7 +655,7 @@ void ssh_poll_ctx_remove(ssh_poll_ctx ctx, ssh_poll_handle p) {
* the poll() function. * the poll() function.
* @returns SSH_OK No error. * @returns SSH_OK No error.
* SSH_ERROR Error happened during the poll. * SSH_ERROR Error happened during the poll.
* SSH_AGAIN Timeout occured * SSH_AGAIN Timeout occurred
*/ */
int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout) int ssh_poll_ctx_dopoll(ssh_poll_ctx ctx, int timeout)
@@ -870,7 +870,7 @@ void ssh_event_remove_poll(ssh_event event, ssh_poll_handle p)
} }
/** /**
* @brief remove the poll handle from session and assign them to a event, * @brief remove the poll handle from session and assign them to an event,
* when used in blocking mode. * when used in blocking mode.
* *
* @param event The ssh_event object * @param event The ssh_event object

View File

@@ -325,7 +325,7 @@ void ssh_scp_free(ssh_scp scp)
* @param[in] mode The UNIX permissions for the new directory, e.g. 0755. * @param[in] mode The UNIX permissions for the new directory, e.g. 0755.
* *
* @returns SSH_OK if the directory has been created, SSH_ERROR if * @returns SSH_OK if the directory has been created, SSH_ERROR if
* an error occured. * an error occurred.
* *
* @see ssh_scp_leave_directory() * @see ssh_scp_leave_directory()
*/ */
@@ -416,7 +416,7 @@ error:
* @brief Leave a directory. * @brief Leave a directory.
* *
* @returns SSH_OK if the directory has been left, SSH_ERROR if an * @returns SSH_OK if the directory has been left, SSH_ERROR if an
* error occured. * error occurred.
* *
* @see ssh_scp_push_directory() * @see ssh_scp_push_directory()
*/ */
@@ -465,7 +465,7 @@ int ssh_scp_leave_directory(ssh_scp scp)
* @param[in] mode The UNIX permissions for the new file, e.g. 0644. * @param[in] mode The UNIX permissions for the new file, e.g. 0644.
* *
* @returns SSH_OK if the file is ready to be sent, SSH_ERROR if an * @returns SSH_OK if the file is ready to be sent, SSH_ERROR if an
* error occured. * error occurred.
* *
* @see ssh_scp_push_file() * @see ssh_scp_push_file()
*/ */
@@ -570,7 +570,7 @@ error:
* @param[in] mode The UNIX permissions for the new file, e.g. 0644. * @param[in] mode The UNIX permissions for the new file, e.g. 0644.
* *
* @returns SSH_OK if the file is ready to be sent, SSH_ERROR if an * @returns SSH_OK if the file is ready to be sent, SSH_ERROR if an
* error occured. * error occurred.
*/ */
int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int mode) int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int mode)
{ {
@@ -589,7 +589,7 @@ int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int mode)
* @param[out] response A pointer where the response message must be copied if * @param[out] response A pointer where the response message must be copied if
* any. This pointer must then be free'd. * any. This pointer must then be free'd.
* *
* @returns The return code, SSH_ERROR a error occured. * @returns The return code, SSH_ERROR a error occurred.
*/ */
int ssh_scp_response(ssh_scp scp, char **response) int ssh_scp_response(ssh_scp scp, char **response)
{ {
@@ -659,7 +659,7 @@ int ssh_scp_response(ssh_scp scp, char **response)
* @param[in] len The number of bytes to write. * @param[in] len The number of bytes to write.
* *
* @returns SSH_OK if the write was successful, SSH_ERROR an error * @returns SSH_OK if the write was successful, SSH_ERROR an error
* occured while writing. * occurred while writing.
*/ */
int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len) int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len)
{ {
@@ -737,7 +737,7 @@ int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len)
* null-terminated. * null-terminated.
* *
* @returns SSH_OK if the string was read, SSH_ERROR if an error * @returns SSH_OK if the string was read, SSH_ERROR if an error
* occured while reading. * occurred while reading.
*/ */
int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len) int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len)
{ {
@@ -885,7 +885,7 @@ int ssh_scp_pull_request(ssh_scp scp)
return SSH_ERROR; return SSH_ERROR;
} }
/* a parsing error occured */ /* a parsing error occurred */
error: error:
SAFE_FREE(name); SAFE_FREE(name);
SAFE_FREE(mode); SAFE_FREE(mode);
@@ -992,7 +992,7 @@ int ssh_scp_accept_request(ssh_scp scp)
* *
* @param[in] size The size of the buffer. * @param[in] size The size of the buffer.
* *
* @returns The nNumber of bytes read, SSH_ERROR if an error occured * @returns The nNumber of bytes read, SSH_ERROR if an error occurred
* while reading. * while reading.
*/ */
int ssh_scp_read(ssh_scp scp, void *buffer, size_t size) int ssh_scp_read(ssh_scp scp, void *buffer, size_t size)

View File

@@ -680,7 +680,7 @@ int ssh_handle_packets(ssh_session session, int timeout) {
* @param[in] timeout Set an upper limit on the time for which this function * @param[in] timeout Set an upper limit on the time for which this function
* will block, in milliseconds. Specifying * will block, in milliseconds. Specifying
* SSH_TIMEOUT_INFINITE (-1) means an infinite timeout. * SSH_TIMEOUT_INFINITE (-1) means an infinite timeout.
* Specifying SSH_TIMEOUT_USER means to use the timeout * Specifying SSH_TIMEOUT_USER means using the timeout
* specified in options. 0 means poll will return * specified in options. 0 means poll will return
* immediately. * immediately.
* SSH_TIMEOUT_DEFAULT uses the session timeout if set or * SSH_TIMEOUT_DEFAULT uses the session timeout if set or
@@ -934,7 +934,7 @@ error:
/** /**
* @brief Set the session data counters. * @brief Set the session data counters.
* *
* This functions sets the counter structures to be used to calculate data * This function sets the counter structures to be used to calculate data
* which comes in and goes out through the session at different levels. * which comes in and goes out through the session at different levels.
* *
* @code * @code
@@ -1109,7 +1109,7 @@ int ssh_get_publickey(ssh_session session, ssh_key *key)
* @return 0 on success, -1 if an error occurred. * @return 0 on success, -1 if an error occurred.
* *
* @warning It is very important that you verify at some moment that the hash * @warning It is very important that you verify at some moment that the hash
* matches a known server. If you don't do it, cryptography wont help * matches a known server. If you don't do it, cryptography won't help
* you at making things secure. * you at making things secure.
* OpenSSH uses SHA256 to print public key digests. * OpenSSH uses SHA256 to print public key digests.
* *

View File

@@ -866,7 +866,7 @@ static int sftp_enqueue(sftp_session sftp, sftp_message msg) {
} }
/* /*
* Pulls of a message from the queue based on the ID. * Pulls a message from the queue based on the ID.
* Returns NULL if no message has been found. * Returns NULL if no message has been found.
*/ */
static sftp_message sftp_dequeue(sftp_session sftp, uint32_t id){ static sftp_message sftp_dequeue(sftp_session sftp, uint32_t id){
@@ -1102,7 +1102,7 @@ sftp_dir sftp_opendir(sftp_session sftp, const char *path)
/* /*
* Parse the attributes from a payload from some messages. It is coded on * Parse the attributes from a payload from some messages. It is coded on
* baselines from the protocol version 4. * baselines from the protocol version 4.
* This code is more or less dead but maybe we need it in future. * This code is more or less dead but maybe we will need it in the future.
*/ */
static sftp_attributes sftp_parse_attr_4(sftp_session sftp, ssh_buffer buf, static sftp_attributes sftp_parse_attr_4(sftp_session sftp, ssh_buffer buf,
int expectnames) { int expectnames) {

View File

@@ -829,7 +829,7 @@ int ssh_socket_set_blocking(socket_t fd)
/** /**
* @internal * @internal
* @brief Launches a socket connection * @brief Launches a socket connection
* If a the socket connected callback has been defined and * If the socket connected callback has been defined and
* a poll object exists, this call will be non blocking. * a poll object exists, this call will be non blocking.
* @param s socket to connect. * @param s socket to connect.
* @param host hostname or ip address to connect to. * @param host hostname or ip address to connect to.

View File

@@ -103,7 +103,7 @@ int ssh_string_fill(struct ssh_string_struct *s, const void *data, size_t len) {
* @return The newly allocated string, NULL on error with errno * @return The newly allocated string, NULL on error with errno
* set. * set.
* *
* @note The nul byte is not copied nor counted in the ouput string. * @note The null byte is not copied nor counted in the output string.
*/ */
struct ssh_string_struct *ssh_string_from_char(const char *what) { struct ssh_string_struct *ssh_string_from_char(const char *what) {
struct ssh_string_struct *ptr; struct ssh_string_struct *ptr;
@@ -129,7 +129,7 @@ struct ssh_string_struct *ssh_string_from_char(const char *what) {
/** /**
* @brief Return the size of a SSH string. * @brief Return the size of a SSH string.
* *
* @param[in] s The the input SSH string. * @param[in] s The input SSH string.
* *
* @return The size of the content of the string, 0 on error. * @return The size of the content of the string, 0 on error.
*/ */
@@ -149,7 +149,7 @@ size_t ssh_string_len(struct ssh_string_struct *s) {
} }
/** /**
* @brief Get the the string as a C nul-terminated string. * @brief Get the string as a C null-terminated string.
* *
* This is only available as long as the SSH string exists. * This is only available as long as the SSH string exists.
* *
@@ -168,7 +168,7 @@ const char *ssh_string_get_char(struct ssh_string_struct *s)
} }
/** /**
* @brief Convert a SSH string to a C nul-terminated string. * @brief Convert a SSH string to a C null-terminated string.
* *
* @param[in] s The SSH input string. * @param[in] s The SSH input string.
* *

View File

@@ -25,7 +25,7 @@
* Why a wrapper? * Why a wrapper?
* *
* Let's say you want to port libssh from libcrypto of openssl to libfoo * Let's say you want to port libssh from libcrypto of openssl to libfoo
* you are going to spend hours to remove every references to SHA1_Update() * you are going to spend hours removing every reference to SHA1_Update()
* to libfoo_sha1_update after the work is finished, you're going to have * to libfoo_sha1_update after the work is finished, you're going to have
* only this file to modify it's not needed to say that your modifications * only this file to modify it's not needed to say that your modifications
* are welcome. * are welcome.