Re: WARNING: SMPP: PDU element <password> to long (length is 9, should be 9)
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | The Kannel Group |
| Message-ID | <[email protected]> |
Alan McNatty wrote: > Hi All, > > Just checking - the SMPP password field can be max octets of 9 in > length. But when I set it to be 9 characters in length I get a warning > that's it's too long, etc. > > My understanding of octets is not fantastic (like a C string - has a > null char which takes up 1?) so looking for some confirmation on what's > happening here (and maybe adjust the warning to be less confusing?). > Should the warning read 'should be 8'? > > Cheers, > Alan > > > 2004-08-11 09:25:18 [12549] [14] DEBUG: password: "PASSWORD1" > ... > 2004-08-11 09:25:18 [12549] [14] DEBUG: SMPP PDU dump ends. > 2004-08-11 09:25:18 [12549] [14] WARNING: SMPP: PDU element <password> > to long (length is 9, should be 9) Just a quick note Alan (before hitting the meat of the question): Bote that we moved the list to [email protected]. Please change the domain, since 3G Lab doesn't exist, and we don't know how long the good people of Trigenix will keep the 3glab.org domain. Ok, now about the warning. I see this in gw/smsc/smpp_pdu.c:236: ... #define NULTERMINATED(name, max_octets) \ if (p->name != NULL) { \ if (octstr_len(p->name) >= max_octets) { \ warning(0, "SMPP: PDU element <%s> to long " \ "(length is %ld, should be %d)", \ #name, octstr_len(p->name), max_octets); \ temp = octstr_copy(p->name, 0, max_octets-1); \ } else \ temp = octstr_duplicate(p->name); \ octstr_append(os, temp); \ octstr_destroy(temp); \ } \ octstr_append_char(os, '\0'); ... Which means the warning will go out even when we have the max octets in the pdu field. Question should be: why do we compare >= and not only > ??? I don't see any good reason on the equal compare here. Stipe mailto:stolj_{at}_wapme.de ------------------------------------------------------------------- Wapme Systems AG Vogelsanger Weg 80 40470 Düsseldorf, NRW, Germany phone: +49.211.74845.0 fax: +49.211.74845.299 mailto:info_{at}_wapme-systems.de http://www.wapme-systems.de/ ------------------------------------------------------------------- -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.2.2 (Cygwin) mIsEP6mcYwEEAMDnUiUwrbb+xwTFWN6TxF2+XZu7/alwJMeCwMBRvXtPZqfjpPhS OkBpU0F4TrVuugz1HINTSaJTYq10AzDQXp5NkyWgckqW79nPAWuOX0dicbJk+cN2 nM2TI4KaxUDe6u8hghNEnH/i2lXsUu9apnP/iixzV81VC2je3uc9hZpnAAYptEVT dGlwZSBUb2xqIChUZWNobm9sb2d5IENlbnRlciAmIFJlc2VhcmNoIExhYikgPHRv bGpAd2FwbWUtc3lzdGVtcy5kZT6ItAQTAQIAHgUCP6mcYwIbAwYLCQgHAwIDFQID AxYCAQIeAQIXgAAKCRABV0w1BqPYRuSqA/wPzsQxao2YePENCtgRTrO86U6zg3sl OcS6CJFI4FZP5h/xD3GRsNH1+MPSvZlomDdpFnr547DGz/Kq9MXuQwVvlVig5yWZ K5dtKp1r5YLhxJQBhfirZbRFFnYmf19f18J8OoS28tuFVftDl1AIwJS3HLyBTv6H g2HyLAEKQIp30Q== =aYCI -----END PGP PUBLIC KEY BLOCK-----