automerge commit

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@46427 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Automerge script 19 years ago
parent cc1353522f
commit 5c99f456a9

@ -324,7 +324,7 @@ static int app_exec(struct ast_channel *chan, void *data)
close(i); close(i);
execv(argv[0], argv); execv(argv[0], argv);
fprintf(stderr, "Failed to execute '%s': %s\n", argv[0], strerror(errno)); fprintf(stderr, "Failed to execute '%s': %s\n", argv[0], strerror(errno));
exit(1); _exit(1);
} else { } else {
/* parent process */ /* parent process */
int child_events_fd = child_stdin[1]; int child_events_fd = child_stdin[1];

@ -449,7 +449,7 @@ int ast_safe_system(const char *s)
for (x = STDERR_FILENO + 1; x < 4096; x++) for (x = STDERR_FILENO + 1; x < 4096; x++)
close(x); close(x);
execl("/bin/sh", "/bin/sh", "-c", s, NULL); execl("/bin/sh", "/bin/sh", "-c", s, NULL);
exit(1); _exit(1);
} else if (pid > 0) { } else if (pid > 0) {
for(;;) { for(;;) {
res = wait4(pid, &status, 0, &rusage); res = wait4(pid, &status, 0, &rusage);

@ -3839,6 +3839,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data)
ch->state=MISDN_CLEANING; ch->state=MISDN_CLEANING;
} }
break; break;
case EVENT_BCHAN_ERROR:
case EVENT_CLEANUP: case EVENT_CLEANUP:
{ {
stop_bc_tones(ch); stop_bc_tones(ch);

@ -163,7 +163,6 @@ static const char notify_config[] = "sip_notify.conf";
enum subscriptiontype { enum subscriptiontype {
NONE = 0, NONE = 0,
TIMEOUT,
XPIDF_XML, XPIDF_XML,
DIALOG_INFO_XML, DIALOG_INFO_XML,
CPIM_PIDF_XML, CPIM_PIDF_XML,
@ -938,7 +937,7 @@ static void append_date(struct sip_request *req); /* Append date to SIP packet *
static int determine_firstline_parts(struct sip_request *req); static int determine_firstline_parts(struct sip_request *req);
static void sip_dump_history(struct sip_pvt *dialog); /* Dump history to LOG_DEBUG at end of dialog, before destroying data */ static void sip_dump_history(struct sip_pvt *dialog); /* Dump history to LOG_DEBUG at end of dialog, before destroying data */
static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype); static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate); static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout);
static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize); static char *gettag(struct sip_request *req, char *header, char *tagbuf, int tagbufsize);
#ifdef SIP_MIDCOM #ifdef SIP_MIDCOM
@ -1348,8 +1347,7 @@ static int __sip_autodestruct(void *data)
/* If this is a subscription, tell the phone that we got a timeout */ /* If this is a subscription, tell the phone that we got a timeout */
if (p->subscribed) { if (p->subscribed) {
p->subscribed = TIMEOUT; transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1, 1); /* Send first notification */
transmit_state_notify(p, AST_EXTENSION_DEACTIVATED, 1, 1); /* Send first notification */
p->subscribed = NONE; p->subscribed = NONE;
append_history(p, "Subscribestatus", "timeout"); append_history(p, "Subscribestatus", "timeout");
return 10000; /* Reschedule this destruction so that we know that it's gone */ return 10000; /* Reschedule this destruction so that we know that it's gone */
@ -5201,7 +5199,7 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init)
} }
/*! \brief transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/ /*! \brief transmit_state_notify: Used in the SUBSCRIBE notification subsystem ----*/
static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate) static int transmit_state_notify(struct sip_pvt *p, int state, int full, int substate, int timeout)
{ {
char tmp[4000], from[256], to[256]; char tmp[4000], from[256], to[256];
char *t = tmp, *c, *a, *mfrom, *mto; char *t = tmp, *c, *a, *mfrom, *mto;
@ -5297,7 +5295,7 @@ static int transmit_state_notify(struct sip_pvt *p, int state, int full, int sub
add_header(&req, "Content-Type", subscriptiontype->mediatype); add_header(&req, "Content-Type", subscriptiontype->mediatype);
switch(state) { switch(state) {
case AST_EXTENSION_DEACTIVATED: case AST_EXTENSION_DEACTIVATED:
if (p->subscribed == TIMEOUT) if (timeout)
add_header(&req, "Subscription-State", "terminated;reason=timeout"); add_header(&req, "Subscription-State", "terminated;reason=timeout");
else { else {
add_header(&req, "Subscription-State", "terminated;reason=probation"); add_header(&req, "Subscription-State", "terminated;reason=probation");
@ -6587,7 +6585,7 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data)
p->laststate = state; p->laststate = state;
break; break;
} }
transmit_state_notify(p, state, 1, 1); transmit_state_notify(p, state, 1, 1, 0);
if (option_verbose > 1) if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username); ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username);
@ -7348,6 +7346,7 @@ static int check_user_full(struct sip_pvt *p, struct sip_request *req, int sipme
p->amaflags = user->amaflags; p->amaflags = user->amaflags;
p->callgroup = user->callgroup; p->callgroup = user->callgroup;
p->pickupgroup = user->pickupgroup; p->pickupgroup = user->pickupgroup;
if (user->callingpres)
p->callingpres = user->callingpres; p->callingpres = user->callingpres;
p->capability = user->capability; p->capability = user->capability;
p->jointcapability = user->capability; p->jointcapability = user->capability;
@ -7411,6 +7410,7 @@ static int check_user_full(struct sip_pvt *p, struct sip_request *req, int sipme
ast_copy_string(p->subscribecontext, peer->subscribecontext, sizeof(p->subscribecontext)); ast_copy_string(p->subscribecontext, peer->subscribecontext, sizeof(p->subscribecontext));
ast_copy_string(p->peermd5secret, peer->md5secret, sizeof(p->peermd5secret)); ast_copy_string(p->peermd5secret, peer->md5secret, sizeof(p->peermd5secret));
p->peermd5secret[sizeof(p->peermd5secret)-1] = '\0'; p->peermd5secret[sizeof(p->peermd5secret)-1] = '\0';
if (peer->callingpres)
p->callingpres = peer->callingpres; p->callingpres = peer->callingpres;
if (peer->maxms && peer->lastms) if (peer->maxms && peer->lastms)
p->timer_t1 = peer->lastms; p->timer_t1 = peer->lastms;
@ -11206,7 +11206,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
struct sip_pvt *p_old; struct sip_pvt *p_old;
transmit_response(p, "200 OK", req); transmit_response(p, "200 OK", req);
transmit_state_notify(p, firststate, 1, 1); /* Send first notification */ transmit_state_notify(p, firststate, 1, 1, 0); /* Send first notification */
append_history(p, "Subscribestatus", ast_extension_state2str(firststate)); append_history(p, "Subscribestatus", ast_extension_state2str(firststate));
/* remove any old subscription from this peer for the same exten/context, /* remove any old subscription from this peer for the same exten/context,
@ -13423,8 +13423,7 @@ static int sip_sipredirect(struct sip_pvt *p, const char *dest)
snprintf(p->our_contact, sizeof(p->our_contact), "Transfer <sip:%s@%s%s%s>", extension, host, port ? ":" : "", port ? port : ""); snprintf(p->our_contact, sizeof(p->our_contact), "Transfer <sip:%s@%s%s%s>", extension, host, port ? ":" : "", port ? port : "");
transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq, 1); transmit_response_reliable(p, "302 Moved Temporarily", &p->initreq, 1);
/* this is all that we want to send to that SIP device */ sip_scheddestroy(p, 32000); /* Make sure we stop send this reply. */
ast_set_flag(p, SIP_ALREADYGONE);
/* hangup here */ /* hangup here */
return -1; return -1;

@ -2872,7 +2872,6 @@ static int get_input(struct skinnysession *s)
} }
*(int *)s->inbuf = htolel(dlen); *(int *)s->inbuf = htolel(dlen);
res = read(s->fd, s->inbuf+4, dlen+4); res = read(s->fd, s->inbuf+4, dlen+4);
ast_mutex_unlock(&s->lock);
if (res != (dlen+4)) { if (res != (dlen+4)) {
ast_log(LOG_WARNING, "Skinny Client sent less data than expected.\n"); ast_log(LOG_WARNING, "Skinny Client sent less data than expected.\n");
return -1; return -1;

@ -633,17 +633,12 @@ int clean_up_bc(struct misdn_bchannel *bc)
cb_log(2, stack->port, "$$$ Cleaning up bc with stid :%x pid:%d\n", bc->b_stid, bc->pid); cb_log(2, stack->port, "$$$ Cleaning up bc with stid :%x pid:%d\n", bc->b_stid, bc->pid);
manager_bchannel_deactivate(bc);
manager_ec_disable(bc); manager_ec_disable(bc);
manager_bchannel_deactivate(bc);
mISDN_write_frame(stack->midev, buff, bc->layer_id|FLG_MSG_TARGET|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); mISDN_write_frame(stack->midev, buff, bc->layer_id|FLG_MSG_TARGET|FLG_MSG_DOWN, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
/*mISDN_clear_stack(stack->midev, bc->b_stid);*/
bc->b_stid = 0; bc->b_stid = 0;
bc_state_change(bc, BCHAN_CLEANED); bc_state_change(bc, BCHAN_CLEANED);
@ -1014,6 +1009,7 @@ int setup_bc(struct misdn_bchannel *bc)
mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
bc_state_change(bc,BCHAN_ERROR); bc_state_change(bc,BCHAN_ERROR);
cb_event(EVENT_BCHAN_ERROR, bc, glob_mgr->user_data);
return(-EINVAL); return(-EINVAL);
} }
@ -1024,6 +1020,7 @@ int setup_bc(struct misdn_bchannel *bc)
mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
bc_state_change(bc,BCHAN_ERROR); bc_state_change(bc,BCHAN_ERROR);
cb_event(EVENT_BCHAN_ERROR, bc, glob_mgr->user_data);
return(-EINVAL); return(-EINVAL);
} }
@ -1036,6 +1033,8 @@ int setup_bc(struct misdn_bchannel *bc)
mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC); mISDN_write_frame(midev, buff, bc->layer_id, MGR_DELLAYER | REQUEST, 0, 0, NULL, TIMEOUT_1SEC);
bc_state_change(bc,BCHAN_ERROR); bc_state_change(bc,BCHAN_ERROR);
cb_event(EVENT_BCHAN_ERROR, bc, glob_mgr->user_data);
return (-EINVAL);
} }
manager_bchannel_activate(bc); manager_bchannel_activate(bc);
@ -1511,21 +1510,6 @@ int handle_event ( struct misdn_bchannel *bc, enum event_e event, iframe_t *frm)
return 0; return 0;
} }
int handle_new_process(struct misdn_stack *stack, iframe_t *frm)
{
struct misdn_bchannel* bc=misdn_lib_get_free_bc(stack->port, 0, 1);
if (!bc) {
cb_log(0, stack->port, " --> !! lib: No free channel!\n");
return -1;
}
cb_log(7, stack->port, " --> new_process: New L3Id: %x\n",frm->dinfo);
bc->l3_id=frm->dinfo;
return 0;
}
int handle_cr ( struct misdn_stack *stack, iframe_t *frm) int handle_cr ( struct misdn_stack *stack, iframe_t *frm)
{ {
@ -1534,9 +1518,15 @@ int handle_cr ( struct misdn_stack *stack, iframe_t *frm)
switch (frm->prim) { switch (frm->prim) {
case CC_NEW_CR|INDICATION: case CC_NEW_CR|INDICATION:
cb_log(7, stack->port, " --> lib: NEW_CR Ind with l3id:%x on this port.\n",frm->dinfo); cb_log(7, stack->port, " --> lib: NEW_CR Ind with l3id:%x on this port.\n",frm->dinfo);
if (handle_new_process(stack, frm) <0) {
struct misdn_bchannel* bc=misdn_lib_get_free_bc(stack->port, 0, 1);
if (!bc) {
cb_log(0, stack->port, " --> !! lib: No free channel!\n");
return -1; return -1;
} }
cb_log(7, stack->port, " --> new_process: New L3Id: %x\n",frm->dinfo);
bc->l3_id=frm->dinfo;
return 1; return 1;
case CC_NEW_CR|CONFIRM: case CC_NEW_CR|CONFIRM:
return 1; return 1;
@ -1787,12 +1777,10 @@ handle_event_nt(void *dat, void *arg)
case CC_SETUP|INDICATION: case CC_SETUP|INDICATION:
{ {
iframe_t frm; /* fake te frm to add callref to global callreflist */ struct misdn_bchannel* bc=misdn_lib_get_free_bc(stack->port, 0, 1);
frm.dinfo = hh->dinfo; if (!bc)
frm.addr=stack->upper_id; ERR_NO_CHANNEL:
frm.prim = CC_NEW_CR|INDICATION; {
if (handle_cr(stack, &frm)< 0) {
msg_t *dmsg; msg_t *dmsg;
cb_log(4, stack->port, "Patch from MEIDANIS:Sending RELEASE_COMPLETE %x (No free Chan for you..)\n", hh->dinfo); cb_log(4, stack->port, "Patch from MEIDANIS:Sending RELEASE_COMPLETE %x (No free Chan for you..)\n", hh->dinfo);
dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST,MT_RELEASE_COMPLETE, hh->dinfo,sizeof(RELEASE_COMPLETE_t), 1); dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST,MT_RELEASE_COMPLETE, hh->dinfo,sizeof(RELEASE_COMPLETE_t), 1);
@ -1800,6 +1788,16 @@ handle_event_nt(void *dat, void *arg)
free_msg(msg); free_msg(msg);
return 0; return 0;
} }
cb_log(7, stack->port, " --> new_process: New L3Id: %x\n",hh->dinfo);
bc->l3_id=hh->dinfo;
if (bc->channel<=0) {
bc->channel=find_free_chan_in_stack(stack,0);
if (bc->channel<=0)
goto ERR_NO_CHANNEL;
}
} }
break; break;

@ -113,6 +113,7 @@ enum event_e {
EVENT_TONE_GENERATE, EVENT_TONE_GENERATE,
EVENT_BCHAN_DATA, EVENT_BCHAN_DATA,
EVENT_BCHAN_ACTIVATED, EVENT_BCHAN_ACTIVATED,
EVENT_BCHAN_ERROR,
EVENT_CLEANUP, EVENT_CLEANUP,
EVENT_PROCEEDING, EVENT_PROCEEDING,
EVENT_PROGRESS, EVENT_PROGRESS,

@ -1219,6 +1219,7 @@ char EVENT_PORT_ALARM_INFO[] = "ALARM";
char EVENT_BCHAN_DATA_INFO[] = "BCHAN_DATA"; char EVENT_BCHAN_DATA_INFO[] = "BCHAN_DATA";
char EVENT_BCHAN_ACTIVATED_INFO[] = "BCHAN_ACTIVATED"; char EVENT_BCHAN_ACTIVATED_INFO[] = "BCHAN_ACTIVATED";
char EVENT_TONE_GENERATE_INFO[] = "TONE_GENERATE"; char EVENT_TONE_GENERATE_INFO[] = "TONE_GENERATE";
char EVENT_BCHAN_ERROR_INFO[] = "BCHAN_ERROR";
char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt) char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt)
{ {
@ -1234,6 +1235,7 @@ char * isdn_get_info(struct isdn_msg msgs[], enum event_e event, int nt)
if (event == EVENT_BCHAN_ACTIVATED) return EVENT_BCHAN_ACTIVATED_INFO; if (event == EVENT_BCHAN_ACTIVATED) return EVENT_BCHAN_ACTIVATED_INFO;
if (event == EVENT_TONE_GENERATE) return EVENT_TONE_GENERATE_INFO; if (event == EVENT_TONE_GENERATE) return EVENT_TONE_GENERATE_INFO;
if (event == EVENT_PORT_ALARM) return EVENT_PORT_ALARM_INFO; if (event == EVENT_PORT_ALARM) return EVENT_PORT_ALARM_INFO;
if (event == EVENT_BCHAN_ERROR) return EVENT_BCHAN_ERROR_INFO;
return NULL; return NULL;
} }

@ -61,7 +61,7 @@
[ -q ] [ -n ] [ \fIkeyname\fP ] [ -q ] [ -n ] [ \fIkeyname\fP ]
.SH DESCRIPTION .SH DESCRIPTION
.B genzaptelconf .B astgenkey
This script generates an RSA private and public key pair in PEM format This script generates an RSA private and public key pair in PEM format
for use by Asterisk. The private key should be kept a secret, as it can for use by Asterisk. The private key should be kept a secret, as it can
be used to fake your system's identity. Thus by default (without the be used to fake your system's identity. Thus by default (without the

@ -297,7 +297,7 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
/* unblock important signal handlers */ /* unblock important signal handlers */
if (sigfillset(&signal_set) || pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL)) { if (sigfillset(&signal_set) || pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL)) {
ast_log(LOG_WARNING, "unable to unblock signals for AGI script: %s\n", strerror(errno)); ast_log(LOG_WARNING, "unable to unblock signals for AGI script: %s\n", strerror(errno));
exit(1); _exit(1);
} }
/* Close everything but stdin/out/error */ /* Close everything but stdin/out/error */
@ -308,7 +308,7 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
execv(script, argv); execv(script, argv);
/* Can't use ast_log since FD's are closed */ /* Can't use ast_log since FD's are closed */
fprintf(stderr, "Failed to execute '%s': %s\n", script, strerror(errno)); fprintf(stderr, "Failed to execute '%s': %s\n", script, strerror(errno));
exit(1); _exit(1);
} }
if (option_verbose > 2) if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Launched AGI Script %s\n", script); ast_verbose(VERBOSE_PREFIX_3 "Launched AGI Script %s\n", script);

@ -463,7 +463,7 @@ static int spawn_mp3(struct mohclass *class)
} }
ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno)); ast_log(LOG_WARNING, "Exec failed: %s\n", strerror(errno));
close(fds[1]); close(fds[1]);
exit(1); _exit(1);
} else { } else {
/* Parent */ /* Parent */
close(fds[1]); close(fds[1]);

Loading…
Cancel
Save