Allow name to be missing

This commit is contained in:
Jeremy Lakeman 2013-01-16 15:52:06 +10:30
parent ad01836d0e
commit e9d283f3f6
2 changed files with 3 additions and 3 deletions

View File

@ -434,7 +434,7 @@ static int monitor_lookup_match(int argc, const char *const *argv, const struct
struct monitor_context *c=context;
const char *sid=argv[2];
const char *ext=argv[4];
const char *name=argv[5];
const char *name=argc>=4?argv[5]:"";
if (!my_subscriber)
return monitor_write_error(c,"I don't know who I am");
@ -537,7 +537,7 @@ struct command_line_option monitor_options[]={
{monitor_set,{"monitor","vomp","<codec>","...",NULL},0,""},
{monitor_set,{"monitor","<type>",NULL},0,""},
{monitor_clear,{"ignore","<type>",NULL},0,""},
{monitor_lookup_match,{"lookup","match","<sid>","<port>","<ext>","<name>",NULL},0,""},
{monitor_lookup_match,{"lookup","match","<sid>","<port>","<ext>","[<name>]",NULL},0,""},
{monitor_call, {"call","<sid>","<local_did>","<remote_did>",NULL},0,""},
{monitor_call_ring, {"ringing","<token>",NULL},0,""},
{monitor_call_pickup, {"pickup","<token>",NULL},0,""},

View File

@ -488,7 +488,7 @@ int overlay_mdp_dnalookup_reply(const sockaddr_mdp *dstaddr, const unsigned char
/* build reply as TOKEN|URI|DID|NAME|<NUL> */
strbuf b = strbuf_local((char *)mdpreply.out.payload, sizeof mdpreply.out.payload);
strbuf_tohex(b, resolved_sid, SID_SIZE);
strbuf_sprintf(b, "|%s|%s|%s|", uri, did, name);
strbuf_sprintf(b, "|%s|%s|%s|", uri, did, name?name:"");
if (strbuf_overrun(b))
return WHY("MDP payload overrun");
mdpreply.out.payload_length = strbuf_len(b) + 1;