Re: [PATCH] smsbox bearerbox-port
Alexander Malysh <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Mi Reflejo schrieb:
> Yes, you are right, this panic is useless.
>
> Another thing:
> After getting the ssl flag from core (smsbox-port-ssl) to bb_ssl why
> are you doing this:
>
> if (bb_ssl && cfg_get_bool(&bb_ssl, grp,
> octstr_imm("bearerbox-port-ssl")) == -1)
> bb_ssl = 1;
>
> I mean, why bb_ssl must be 1 at this point? Maybe it should be:
>
> if ((cfg_get_bool(&bb_ssl, grp, octstr_imm("bearerbox-port-ssl")) ==
> -1) && bb_ssl)
> bb_ssl = 1;
>
> am i missing something?
hmm you are right here :) fixed patch attached...
>
> M
>
> On 7/7/06, Alexander Malysh <[email protected]> wrote:
>> I don't think so. Please look the init code for bb_port bb_host in
>> smsbox. It will be initialized to BB_DEFAULT_PORT BB_DEFAULT_HOST
>> respectively. And we will panic anyway if bearerbox is not available on
>> this port.
>>
>> Thanks,
>> Alex
>>
>> Mi Reflejo schrieb:
>> > -1 for me.
>> >
>> > I think we need to panic if none of both ports are in config file.
>> > Something like:
>> >
>> >
>> > cfg_get_integer(&bb_port, grp, octstr_imm("smsbox-port"));
>> > cfg_get_integer(&bb_port, grp, octstr_imm("bearerbox-port"));
>> > if ( bb_port == 0)
>> > panic(0, "Missing or bad 'bearerbox-port' or 'smsbox-port'");
>> >
>> > Regards,
>> > Martin
>> >
>> > On 7/7/06, Alexander Malysh <[email protected]> wrote:
>> >> Hi,
>> >>
>> >> please find attached patch that adds two new config options to smsbox
>> >> group: bearerbox-port and bearerbox-port-ssl. This patch should
>> help at
>> >> external modules at least sqlbox now. This issue was already discussed
>> >> on devel ML.
>> >>
>> >> Votes / Comments please.
>> >>
>> >> Thanks,
>> >> Alex
>> >>
>> >>
>> >> Index: doc/userguide/userguide.xml
>> >> ===================================================================
>> >> RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v
>> >> retrieving revision 1.317
>> >> diff -a -u -p -r1.317 userguide.xml
>> >> --- doc/userguide/userguide.xml 12 Jun 2006 00:40:48 -0000 1.317
>> >> +++ doc/userguide/userguide.xml 7 Jul 2006 14:19:18 -0000
>> >> @@ -5112,6 +5112,24 @@ ssl-certkey-file
>> >> The machine in which the bearerbox is.
>> >> </entry></row>
>> >>
>> >> + <row><entry><literal>bearerbox-port (o)</literal></entry>
>> >> + <entry>port-number</entry>
>> >> + <entry valign="bottom">
>> >> + This is the port number to which smsbox will connect
>> bearerbox.
>> >> + If not given <literal>smsbox-port</literal> from core group
>> >> used.
>> >> + </entry></row>
>> >> +
>> >> + <row><entry><literal>bearerbox-port-ssl (o)</literal></entry>
>> >> + <entry>bool</entry>
>> >> + <entry valign="bottom">
>> >> + If set to true, the smsbox connection will be SSL-enabled.
>> >> + Your smsbox will connect using SSL to the bearerbox
>> >> + then. This is used to secure communication between bearerbox
>> >> + and smsboxes in case they are in separate networks
>> operated and
>> >> + the TCP communication is not secured on a lower network
>> layer.
>> >> + If not given <literal>smsbox-port-ssl</literal> from core
>> >> group used.
>> >> + </entry></row>
>> >> +
>> >> <row><entry><literal>smsbox-id (o)</literal></entry>
>> >> <entry>string</entry>
>> >> <entry valign="bottom">
>> >> Index: gw/smsbox.c
>> >> ===================================================================
>> >> RCS file: /home/cvs/gateway/gw/smsbox.c,v
>> >> retrieving revision 1.266
>> >> diff -a -u -p -r1.266 smsbox.c
>> >> --- gw/smsbox.c 15 May 2006 18:24:40 -0000 1.266
>> >> +++ gw/smsbox.c 7 Jul 2006 14:19:19 -0000
>> >> @@ -3335,8 +3335,7 @@ static Cfg *init_smsbox(Cfg *cfg)
>> >>
>> >> grp = cfg_get_single_group(cfg, octstr_imm("core"));
>> >>
>> >> - if (cfg_get_integer(&bb_port, grp, octstr_imm("smsbox-port"))
>> == -1)
>> >> - panic(0, "Missing or bad 'smsbox-port' in core group");
>> >> + cfg_get_integer(&bb_port, grp, octstr_imm("smsbox-port"));
>> >> #ifdef HAVE_LIBSSL
>> >> cfg_get_bool(&bb_ssl, grp, octstr_imm("smsbox-port-ssl"));
>> >> #endif /* HAVE_LIBSSL */
>> >> @@ -3372,6 +3371,11 @@ static Cfg *init_smsbox(Cfg *cfg)
>> >> octstr_destroy(bb_host);
>> >> bb_host = p;
>> >> }
>> >> + cfg_get_integer(&bb_port, grp, octstr_imm("bearerbox-port"));
>> >> +#ifdef HAVE_LIBSSL
>> >> + if (bb_ssl && cfg_get_bool(&bb_ssl, grp,
>> >> octstr_imm("bearerbox-port-ssl")) == -1)
>> >> + bb_ssl = 1;
>> >> +#endif /* HAVE_LIBSSL */
>> >>
>> >> cfg_get_bool(&mo_recode, grp, octstr_imm("mo-recode"));
>> >> if(mo_recode < 0)
>> >> Index: gwlib/cfg.def
>> >> ===================================================================
>> >> RCS file: /home/cvs/gateway/gwlib/cfg.def,v
>> >> retrieving revision 1.118
>> >> diff -a -u -p -r1.118 cfg.def
>> >> --- gwlib/cfg.def 9 May 2006 14:32:31 -0000 1.118
>> >> +++ gwlib/cfg.def 7 Jul 2006 14:19:20 -0000
>> >> @@ -243,6 +243,8 @@ SINGLE_GROUP(configuration,
>> >> SINGLE_GROUP(smsbox,
>> >> OCTSTR(smsbox-id)
>> >> OCTSTR(bearerbox-host)
>> >> + OCTSTR(bearerbox-port)
>> >> + OCTSTR(bearerbox-port-ssl)
>> >> OCTSTR(sendsms-port)
>> >> OCTSTR(sendsms-port-ssl)
>> >> OCTSTR(sendsms-interface)
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>>
>
>
smsbox-bearerbox-port.patch
(text/plain, 3 KB)
Index: doc/userguide/userguide.xml
===================================================================
RCS file: /home/cvs/gateway/doc/userguide/userguide.xml,v
retrieving revision 1.317
diff -a -u -p -r1.317 userguide.xml
--- doc/userguide/userguide.xml 12 Jun 2006 00:40:48 -0000 1.317
+++ doc/userguide/userguide.xml 7 Jul 2006 19:08:50 -0000
@@ -5112,6 +5112,24 @@ ssl-certkey-file
The machine in which the bearerbox is.
</entry></row>
+ <row><entry><literal>bearerbox-port (o)</literal></entry>
+ <entry>port-number</entry>
+ <entry valign="bottom">
+ This is the port number to which smsbox will connect bearerbox.
+ If not given <literal>smsbox-port</literal> from core group used.
+ </entry></row>
+
+ <row><entry><literal>bearerbox-port-ssl (o)</literal></entry>
+ <entry>bool</entry>
+ <entry valign="bottom">
+ If set to true, the smsbox connection will be SSL-enabled.
+ Your smsbox will connect using SSL to the bearerbox
+ then. This is used to secure communication between bearerbox
+ and smsboxes in case they are in separate networks operated and
+ the TCP communication is not secured on a lower network layer.
+ If not given <literal>smsbox-port-ssl</literal> from core group used.
+ </entry></row>
+
<row><entry><literal>smsbox-id (o)</literal></entry>
<entry>string</entry>
<entry valign="bottom">
Index: gw/smsbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsbox.c,v
retrieving revision 1.266
diff -a -u -p -r1.266 smsbox.c
--- gw/smsbox.c 15 May 2006 18:24:40 -0000 1.266
+++ gw/smsbox.c 7 Jul 2006 19:08:52 -0000
@@ -3335,8 +3335,7 @@ static Cfg *init_smsbox(Cfg *cfg)
grp = cfg_get_single_group(cfg, octstr_imm("core"));
- if (cfg_get_integer(&bb_port, grp, octstr_imm("smsbox-port")) == -1)
- panic(0, "Missing or bad 'smsbox-port' in core group");
+ cfg_get_integer(&bb_port, grp, octstr_imm("smsbox-port"));
#ifdef HAVE_LIBSSL
cfg_get_bool(&bb_ssl, grp, octstr_imm("smsbox-port-ssl"));
#endif /* HAVE_LIBSSL */
@@ -3372,6 +3371,11 @@ static Cfg *init_smsbox(Cfg *cfg)
octstr_destroy(bb_host);
bb_host = p;
}
+ cfg_get_integer(&bb_port, grp, octstr_imm("bearerbox-port"));
+#ifdef HAVE_LIBSSL
+ if (cfg_get_bool(&bb_ssl, grp, octstr_imm("bearerbox-port-ssl")) == -1 && bb_ssl)
+ bb_ssl = 1;
+#endif /* HAVE_LIBSSL */
cfg_get_bool(&mo_recode, grp, octstr_imm("mo-recode"));
if(mo_recode < 0)
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.118
diff -a -u -p -r1.118 cfg.def
--- gwlib/cfg.def 9 May 2006 14:32:31 -0000 1.118
+++ gwlib/cfg.def 7 Jul 2006 19:08:52 -0000
@@ -243,6 +243,8 @@ SINGLE_GROUP(configuration,
SINGLE_GROUP(smsbox,
OCTSTR(smsbox-id)
OCTSTR(bearerbox-host)
+ OCTSTR(bearerbox-port)
+ OCTSTR(bearerbox-port-ssl)
OCTSTR(sendsms-port)
OCTSTR(sendsms-port-ssl)
OCTSTR(sendsms-interface)