Re: Some remarks
Colin Pitrat <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | Bull |
| Message-ID | <[email protected]> |
Oups, of course I forgot the attachment !
Colin
Colin Pitrat wrote:
> Hello,
> here is another patch as attachment. It concerns contrib/php-admin which
> is broken when php is configured with register_globals=Off (reccomended)
> and use of name instead of value in "option" tag.
>
> I'm currently working on making these scripts better.
>
> Regards,
> Colin
>
> Colin Pitrat wrote:
>> Hello,
>> as I tested kannel, I found a few things :
>>
>> - in test/fakesmsc.c, the short option for port should be "-p" but
>> in the code it is defined as "-r". Here is the modification I made :
>>
>> -------------------------------------------------------------------------
>> diff -ru gateway-1.4.0/test/fakesmsc.c gateway-1.4.0-new/test/fakesmsc.c
>> --- gateway-1.4.0/test/fakesmsc.c 2004-10-28 18:32:14.000000000
>> +0200
>> +++ gateway-1.4.0-new/test/fakesmsc.c 2006-06-30 15:26:50.000000000
>> +0200
>> @@ -161,7 +161,7 @@
>> /* our arguments */
>> static int check_args(int i, int argc, char **argv)
>> {
>> - if (strcmp(argv[i], "-r")==0 || strcmp(argv[i], "--port")==0)
>> + if (strcmp(argv[i], "-p")==0 || strcmp(argv[i], "--port")==0)
>> port = atoi(argv[i+1]);
>> else if (!strcmp(argv[i], "-H") || !strcmp(argv[i], "--host"))
>> host = octstr_create(argv[i+1]);
>> -------------------------------------------------------------------------
>>
>> - On sending an empty MWI sms (without udh), a default "empty
>> message" message is added. Judging by the fields_to_dcs function in
>> sms.c, the message should remain empty. Here is the modifications I
>> made :
>>
>> -------------------------------------------------------------------------
>> --- gateway-1.4.0/gw/smsbox.c 2006-06-26 17:35:50.000000000 +0200
>> +++ gateway-1.4.0-new/gw/smsbox.c 2006-06-27 16:40:09.000000000
>> +0200
>> @@ -257,12 +257,9 @@
>> * a) it's a HTTP sms-service reply: either ignore it or
>> * substitute the "empty" warning defined
>> * b) it's a sendsms HTTP interface call: leave the message empty
>> - * if at least a UDH is given.
>> - *
>> - * XXX this still does not cover the case when the sendsms
>> interface is
>> - * used with *no* text and udh. What should we do then?!
>> */
>> - if (octstr_len(msg->sms.msgdata) == 0 &&
>> octstr_len(msg->sms.udhdata) == 0) {
>> + if (octstr_len(msg->sms.msgdata) == 0 && msg->sms.sms_type ==
>> mt_reply) {
>> + //if (octstr_len(msg->sms.msgdata) == 0 &&
>> octstr_len(msg->sms.udhdata) == 0) {
>> if (trans != NULL && urltrans_omit_empty(trans))
>> return 0;
>> else
>> -------------------------------------------------------------------------
>>
>> Regards,
>> Colin
>>
>> _______________________________________________
>> devel mailing list
>> [email protected]
>> http://www.kannel.org/mailman/listinfo/devel
>>
>
patch
(text/plain, 5 KB)
diff -ur php-admin/admin.php php-admin-new/admin.php
--- php-admin/admin.php 2000-12-01 13:49:56.000000000 +0100
+++ php-admin-new/admin.php 2006-07-06 14:42:13.000000000 +0200
@@ -8,10 +8,12 @@
include("config.inc");
include("functions.inc");
+$command = $_GET["command"];
+
switch($command)
{
case "status":
- $URL = "/cgi-bin/status";
+ $URL = "/cgi-bin/status?password=".STATUS_PASSWORD;
http_send($URL,ADMIN_PORT);
break;
case "suspend":
diff -ur php-admin/config.inc php-admin-new/config.inc
--- php-admin/config.inc 2000-12-01 13:49:56.000000000 +0100
+++ php-admin-new/config.inc 2006-07-06 14:54:38.000000000 +0200
@@ -8,6 +8,7 @@
define("SENDSMS_PORT", "13131");
define("ADMIN_PORT", "13000");
define("ADMIN_PASSWORD", "foobar");
+define("STATUS_PASSWORD", "foobar");
define("USERNAME", "simple");
define("PASSWORD", "elpmis");
define("GLOBAL_SENDER", "0999666666");
diff -ur php-admin/sendota.php php-admin-new/sendota.php
--- php-admin/sendota.php 2000-12-01 13:49:56.000000000 +0100
+++ php-admin-new/sendota.php 2006-07-06 14:51:38.000000000 +0200
@@ -8,7 +8,21 @@
include("config.inc");
include("functions.inc");
-if ($submit)
+$to = $_POST["to"];
+$otalocation = $_POST["otalocation"];
+$otaservice = $_POST["otaservice"];
+$otaip = $_POST["otaip"];
+$otaphone = $_POST["otaphone"];
+$bearer = $_POST["bearer"];
+$connection = $_POST["connection"];
+$calltype = $_POST["calltype"];
+$speed = $_POST["speed"];
+$Off = $_POST["Off"];
+$otaauth = $_POST["otaauth"];
+$otalogin = $_POST["otalogin"];
+$otapassword = $_POST["otapassword"];
+
+if ($_POST["submit"])
{
$text = "%01%06%04%03%94%81%EA%00%01%45%C6%06%01%87%12";
$text .= (strcasecmp($connection,"data") == 0) ? "%45" : "%FF";
@@ -69,12 +83,12 @@
<tr><td>Service Name:</td><td><input type="text" size="30" name="otaservice"> <i>(ie. You Wapsite)</i></td></tr>
<tr><td>IP address:</td><td><input type="text" size="30" name="otaip"> <i>(ie. 192.168.1.1)</i></td></tr>
<tr><td>Phone number:</td><td><input type="text" size="30" name="otaphone"> <i>(ie. 4512345678)</i></td></tr>
-<tr><td>Bearer type:</td><td><select name="bearer"><option name="data" selected>data<option name="sms">SMS</select> <i>(ie. data)</i></td></tr>
-<tr><td>Connection type:</td><td><select name="connection"><option name="temp" selected>Temp<option name="cont">cont</select> <i>(ie. temp)</i></td></tr>
-<tr><td>Call type:</td><td><select name="calltype"><option name="ISDN" selected>ISDN<option name="Analog">Analog</select> <i>(ie. ISDN)</i></td></tr>
-<tr><td>Speed:</td><td><select name="speed"><option name="9600" selected>9600<option name="14400">14400</select> <i>(ie. 9600)</i></td></tr>
-<tr><td>PPP security:</td><td><select><option name="Off" selected>Off<option name="On">On</select> <i>(ie. Off)</i></td></tr>
-<tr><td>Authentication:</td><td><select name="otaauth"><option name="Normal" selected>Normal<option name="Secure">Secure</select> <i>(ie. Normal)</i></td></tr>
+<tr><td>Bearer type:</td><td><select name="bearer"><option value="data" selected>data<option value="sms">SMS</select> <i>(ie. data)</i></td></tr>
+<tr><td>Connection type:</td><td><select name="connection"><option value="temp" selected>Temp<option value="cont">cont</select> <i>(ie. temp)</i></td></tr>
+<tr><td>Call type:</td><td><select name="calltype"><option value="ISDN" selected>ISDN<option value="Analog">Analog</select> <i>(ie. ISDN)</i></td></tr>
+<tr><td>Speed:</td><td><select name="speed"><option value="9600" selected>9600<option value="14400">14400</select> <i>(ie. 9600)</i></td></tr>
+<tr><td>PPP security:</td><td><select><option value="Off" selected>Off<option value="On">On</select> <i>(ie. Off)</i></td></tr>
+<tr><td>Authentication:</td><td><select name="otaauth"><option value="Normal" selected>Normal<option value="Secure">Secure</select> <i>(ie. Normal)</i></td></tr>
<tr><td>Login:</td><td><input type="text" size="30" name="otalogin"> <i>(ie. login)</i></td></tr>
<tr><td>Password:</td><td><input type="password" size="30" name="otapassword"> <i>(ie. secret)</i></td></tr>
</table>
diff -ur php-admin/sendsms.php php-admin-new/sendsms.php
--- php-admin/sendsms.php 2000-12-01 13:49:56.000000000 +0100
+++ php-admin-new/sendsms.php 2006-07-06 14:46:16.000000000 +0200
@@ -8,7 +8,10 @@
include("config.inc");
include("functions.inc");
-if ($submit)
+$to = $_POST["to"];
+$text = $_POST["text"];
+
+if ($_POST["submit"])
{
echo "Sending the SMS Text message <b>\"$text\"</b> to the phone <b>$to</b>...<br>\n";
$URL = "/cgi-bin/sendsms?username=".USERNAME."&password=".PASSWORD."&from=".GLOBAL_SENDER."&to=$to&text=".urlencode($text);
diff -ur php-admin/sendvcard.php php-admin-new/sendvcard.php
--- php-admin/sendvcard.php 2000-12-01 13:49:56.000000000 +0100
+++ php-admin-new/sendvcard.php 2006-07-06 14:48:36.000000000 +0200
@@ -8,7 +8,12 @@
include("config.inc");
include("functions.inc");
-if ($submit)
+$telephone = $_POST["telephone"];
+$firstname = $_POST["firstname"];
+$lastname = $_POST["lastname"];
+$to = $_POST["to"];
+
+if ($_POST["submit"])
{
$text = "BEGIN:VCARD\r\n";
$text .= "VERSION:2.1\r\n";