Skinny: security

- Avoid writing outside of fields
- tab ident
This commit is contained in:
Mathieu Parent 2010-04-02 14:47:37 +02:00
parent 8950d00b1f
commit 9cf882566f
5 changed files with 1784 additions and 1737 deletions

View File

@ -628,17 +628,17 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
if(listener) {
if(call_state == SKINNY_CONNECTED) {
stop_tone(listener, line_instance, call_id);
send_stop_tone(listener, line_instance, call_id);
}
set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
clear_prompt_status(listener, line_instance, call_id);
send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
send_clear_prompt_status(listener, line_instance, call_id);
if(call_state == SKINNY_CONNECTED) { /* calling parties */
close_receive_channel(listener,
send_close_receive_channel(listener,
call_id, /* uint32_t conference_id, */
helper->tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
call_id /* uint32_t conference_id2, */
);
stop_media_transmission(listener,
send_stop_media_transmission(listener,
call_id, /* uint32_t conference_id, */
helper->tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
call_id /* uint32_t conference_id2, */
@ -648,8 +648,8 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
skinny_line_set_state(listener, line_instance, call_id, SKINNY_ON_HOOK);
send_select_soft_keys(listener, line_instance, call_id, SKINNY_KEY_SET_ON_HOOK, 0xffff);
/* TODO: DefineTimeDate */
set_speaker_mode(listener, SKINNY_SPEAKER_OFF);
set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, call_id);
send_set_speaker_mode(listener, SKINNY_SPEAKER_OFF);
send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, call_id);
}
return 0;

View File

@ -249,7 +249,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const c
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
} else {
stream->write_function(stream, "Listener not found!\n");
}
@ -268,7 +268,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_lamp_message(const cha
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
} else {
stream->write_function(stream, "Listener not found!\n");
}
@ -287,7 +287,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_speaker_mode_message(c
listener_t *listener = NULL;
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
if(listener) {
set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
} else {
stream->write_function(stream, "Listener not found!\n");
}

File diff suppressed because it is too large Load Diff

View File

@ -347,8 +347,8 @@ struct button_template_message {
#define CAPABILITIES_REQ_MESSAGE 0x009B
/* RegisterRejectMessage */
#define REGISTER_REJ_MESSAGE 0x009D
struct register_rej_message {
#define REGISTER_REJECT_MESSAGE 0x009D
struct register_reject_message {
char error[33];
};
@ -528,7 +528,7 @@ union skinny_data {
struct config_stat_res_message config_res;
struct define_time_date_message define_time_date;
struct button_template_message button_template;
struct register_rej_message reg_rej;
struct register_reject_message reg_rej;
struct reset_message reset;
struct open_receive_channel_message open_receive_channel;
struct close_receive_channel_message close_receive_channel;
@ -642,26 +642,32 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
/*****************************************************************************/
/* SKINNY MESSAGE HELPER */
/*****************************************************************************/
switch_status_t start_tone(listener_t *listener,
switch_status_t send_register_ack(listener_t *listener,
uint32_t keep_alive,
char *date_format,
char *reserved,
uint32_t secondary_keep_alive,
char *reserved2);
switch_status_t send_start_tone(listener_t *listener,
uint32_t tone,
uint32_t reserved,
uint32_t line_instance,
uint32_t call_id);
switch_status_t stop_tone(listener_t *listener,
switch_status_t send_stop_tone(listener_t *listener,
uint32_t line_instance,
uint32_t call_id);
switch_status_t set_ringer(listener_t *listener,
switch_status_t send_set_ringer(listener_t *listener,
uint32_t ring_type,
uint32_t ring_mode,
uint32_t line_instance,
uint32_t call_id);
switch_status_t set_lamp(listener_t *listener,
switch_status_t send_set_lamp(listener_t *listener,
uint32_t stimulus,
uint32_t stimulus_instance,
uint32_t mode);
switch_status_t set_speaker_mode(listener_t *listener,
switch_status_t send_set_speaker_mode(listener_t *listener,
uint32_t mode);
switch_status_t start_media_transmission(listener_t *listener,
switch_status_t send_start_media_transmission(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t remote_ip,
@ -672,7 +678,7 @@ switch_status_t start_media_transmission(listener_t *listener,
uint32_t silence_suppression,
uint16_t max_frames_per_packet,
uint32_t g723_bitrate);
switch_status_t stop_media_transmission(listener_t *listener,
switch_status_t send_stop_media_transmission(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2);
@ -697,7 +703,18 @@ switch_status_t send_call_info(listener_t *listener,
uint32_t call_instance,
uint32_t call_security_status,
uint32_t party_pi_restriction_bits);
switch_status_t open_receive_channel(listener_t *listener,
switch_status_t send_define_time_date(listener_t *listener,
uint32_t year,
uint32_t month,
uint32_t day_of_week, /* monday = 1 */
uint32_t day,
uint32_t hour,
uint32_t minute,
uint32_t seconds,
uint32_t milliseconds,
uint32_t timestamp);
switch_status_t send_define_current_time_date(listener_t *listener);
switch_status_t send_open_receive_channel(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t packets,
@ -706,7 +723,7 @@ switch_status_t open_receive_channel(listener_t *listener,
uint32_t g723_bitrate,
uint32_t conference_id2,
uint32_t reserved[10]);
switch_status_t close_receive_channel(listener_t *listener,
switch_status_t send_close_receive_channel(listener_t *listener,
uint32_t conference_id,
uint32_t pass_thru_party_id,
uint32_t conference_id2);
@ -719,15 +736,15 @@ switch_status_t send_call_state(listener_t *listener,
uint32_t call_state,
uint32_t line_instance,
uint32_t call_id);
switch_status_t display_prompt_status(listener_t *listener,
switch_status_t send_display_prompt_status(listener_t *listener,
uint32_t timeout,
char display[32],
uint32_t line_instance,
uint32_t call_id);
switch_status_t clear_prompt_status(listener_t *listener,
switch_status_t send_clear_prompt_status(listener_t *listener,
uint32_t line_instance,
uint32_t call_id);
switch_status_t activate_call_plane(listener_t *listener,
switch_status_t send_activate_call_plane(listener_t *listener,
uint32_t line_instance);
switch_status_t send_dialed_number(listener_t *listener,
char called_party[24],

View File

@ -73,7 +73,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
{"DefineTimeDateMessage", DEFINE_TIME_DATE_MESSAGE},
{"ButtonTemplateResMessage", BUTTON_TEMPLATE_RES_MESSAGE},
{"CapabilitiesReqMessage", CAPABILITIES_REQ_MESSAGE},
{"RegisterRejMessage", REGISTER_REJ_MESSAGE},
{"RegisterRejectMessage", REGISTER_REJECT_MESSAGE},
{"ResetMessage", RESET_MESSAGE},
{"KeepAliveAckMessage", KEEP_ALIVE_ACK_MESSAGE},
{"OpenReceiveChannelMessage", OPEN_RECEIVE_CHANNEL_MESSAGE},