Hi,
I tested OBEX authentication functionalities implemented in the newest
obexpushd from Hendrik's repository (r136).
Although normal file pushing functionality works fine, the OBEX
authentication procedure had many faults and didn't work well if I use -a
option to enable this feature.

I've made a naïve patch below and confirmed that obexpushd works well with
nokia N95 using OBEX authentication features.
Following patches are made only to correct the OBEX authentication feature
and need more review.
Especially  "get_pass_for_user" function seems does not read the password
from a text file so I hard coded the password "1234" for the test :)
Please review these patches for three files. I also commented shortly for
the lines I added or modified.
I hope that this might be helpful to improve openobex.


diff trunk_r136/src/io/core.c trunk/src/io/core.c
39c39,40
<       if (data->child) {
---
>       // script is null unless -s option is used.
>       if (data->child && script!=NULL) {


diff trunk_r136/src/obex_auth.c trunk/src/obex_auth.c
93,96c93,101
<       for (; i < size; i += h.bs[i+1]) {
<               uint8_t htype = h.bs[i];
<               uint8_t hlen = h.bs[i+1];
<               const uint8_t* hdata = h.bs+i+2;
---
>       uint8_t htype;
>       uint8_t hlen;
>       const uint8_t* hdata;
>
>       // The length in TLV does not include the size of type and length
itself. So we add two more bytes to iterator.
>       for (; i < size; i += h.bs[i+1]+2) {
>               htype = h.bs[i];
>               hlen = h.bs[i+1];
>               hdata = h.bs+i+2;


diff trunk_r136/src/obexpushd.c trunk/src/obexpushd.c
157a158,168
>       // get_pass_for_user seems does not work well. I hard coded the
password for the test purpose.
>       int i;
>       for (i=0; i<1024; i++){
>               if( pass[i]!=0 )
>                       printf("%d\t", pass[i]);
>       }
>       printf("i [%d]\n", i);
>       if (i==1024){
>               pass[0]='1'; pass[1]='2'; pass[2]='3'; pass[3]='4';
>               len=4;
>       }
335a347,350
>               // target header often comes.
>               case OBEX_HDR_TARGET:
>                       break;
>
367c382,384
<       case OBEX_EV_REQHINT: /* A new request is coming in */
---
>       // Headers are only accessable by REQ event and the authentication
procedure should be done using headers.
>       //case OBEX_EV_REQHINT: /* A new request is coming in */
>       case OBEX_EV_REQ: /* A new request is has come */
407a425,434
>       // We shoud parse headers after REQ event for connect and send or
receive authentication headers here.
>       if ( event==OBEX_EV_REQ ) {
>               if (obj && !obex_object_headers(handle,obj)) {
>                       (void)OBEX_ObjectSetRsp(obj,
>                                               OBEX_RSP_BAD_REQUEST,
>                                               OBEX_RSP_BAD_REQUEST);
>                       return;
>               }
>       }
>




------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Openobex-users mailing list
Openobex-users@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to