/*****************************************************************************/ int
scp_port_to_unix_domain_path(constchar *port, char *buff, unsignedint bufflen)
{ /* GOTCHA: Changes to this logic should be mirrored in
* scp_port_to_display_string() */
int result;
/* Make sure we can safely de-reference 'port' */ if (port == NULL)
{
port = "";
}
if (port[0] == '/')
{
result = g_snprintf(buff, bufflen, "%s", port);
} else
{ constchar *sep; if ((sep = g_strrchr(port, '/')) != NULL && sep != port)
{ /* We allow the user to specify an absolute path, but not
* a relative one with embedded '/' characters */
LOG(LOG_LEVEL_WARNING, "Ignoring path elements of '%s'", port);
port = sep + 1;
}
if (port[0] == '\0')
{
port = SCP_LISTEN_PORT_BASE_STR;
} elseif (is_positive_int(port))
{ /* Version v0.9.x and earlier of xrdp used a TCP port *number.Ifwecomeacrossthis,we'llignoreitfor
* compatibility with old config files */
LOG(LOG_LEVEL_WARNING, "Ignoring obsolete SCP port value '%s'", port);
port = SCP_LISTEN_PORT_BASE_STR;
}
result = g_snprintf(buff, bufflen, XRDP_SOCKET_ROOT_PATH "/%s", port);
}
return result;
}
/*****************************************************************************/ int
scp_port_to_display_string(constchar *port, char *buff, unsignedint bufflen)
{ /* Make sure we can safely de-reference 'port' */ if (port == NULL)
{
port = "";
}
/* Ignore any directories for the display */ constchar *sep; if ((sep = g_strrchr(port, '/')) != NULL)
{
port = sep + 1;
}
/* Check for a default */ if (port[0] == '\0' || g_strcmp(port, "3350") == 0)
{
port = SCP_LISTEN_PORT_BASE_STR;
}
return g_snprintf(buff, bufflen, "%s", port);
}
/*****************************************************************************/ struct trans *
scp_connect(constchar *port, constchar *peername, int (*term_func)(void))
{ char sock_path[256]; struct trans *t;
if (scp_init_trans(result) != 0)
{
LOG(LOG_LEVEL_ERROR, "scp_init_trans() call failed");
trans_delete(result);
result = NULL;
}
}
return result;
}
/*****************************************************************************/ int
scp_msg_in_check_available(struct trans *trans, int *available)
{ return libipm_msg_in_check_available(trans, available);
}
int
scp_get_set_peername_request(struct trans *trans, constchar **peername)
{ return libipm_msg_in_parse( trans, "s", peername);
}
/*****************************************************************************/ int
scp_send_uds_login_request(struct trans *trans)
{ return libipm_msg_out_simple_send(trans,
(int)E_SCP_UDS_LOGIN_REQUEST,
NULL);
}
/*****************************************************************************/ int
scp_send_sys_login_request(struct trans *trans, constchar *username, constchar *password, constchar *ip_addr)
{ int rv;
int
scp_get_sys_login_request(struct trans *trans, constchar **username, constchar **password, constchar **ip_addr)
{ /* Make sure the buffer is cleared after processing this message */
libipm_set_flags(trans, LIBIPM_E_MSG_IN_ERASE_AFTER_USE);
int
scp_get_login_response(struct trans *trans, enum scp_login_status *login_result, int *server_closed, int *uid)
{
int32_t i_login_result = 0;
int32_t i_uid = 0; int dummy;
/* User can pass in NULL for server_closed if they're trying an *loginmethodlikeUDSforwhichallfailsarefatal.Likewise
* they may be uninterested in the uid */ if (server_closed == NULL)
{
server_closed = &dummy;
} if (uid == NULL)
{
uid = &dummy;
}
if (rv == 0)
{ /* Allocate a block of memory large enough for the
* structure result, and the strings it contains */ unsignedint len = sizeof(struct scp_session_info) +
g_strlen(i_start_ip_addr) + 1; if ((p = (struct scp_session_info *)g_malloc(len, 1)) == NULL)
{
*status = E_SCP_LS_NO_MEMORY;
} else
{ /* Set up the string pointers in the block to point
* into the memory allocated after the block */
p->start_ip_addr =
(char *)p + sizeof(struct scp_session_info);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.