From d49ee6233029b9782b04a7eb0fe14923133ff490 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Sat, 10 Sep 2011 15:59:17 +0200 Subject: [PATCH] afpfs-ng: add patches from xbmc project Signed-off-by: Stephan Raue --- ...-ng-0.8.1-01-Fix_searching_of_afpfsd.patch | 14 - .../patches/afpfs-ng-0.8.1-01-gcrypt.patch | 25 ++ .../patches/afpfs-ng-0.8.1-02-pointer.patch | 280 ++++++++++++++++++ .../patches/afpfs-ng-0.8.1-04-boxee1.patch | 26 ++ .../patches/afpfs-ng-0.8.1-05-boxee2.patch | 90 ++++++ .../patches/afpfs-ng-0.8.1-06-boxee3.patch | 142 +++++++++ .../patches/afpfs-ng-0.8.1-07-boxee4.patch | 28 ++ .../patches/afpfs-ng-0.8.1-08-boxee5.patch | 12 + .../patches/afpfs-ng-0.8.1-10-fix-errno.patch | 25 ++ 9 files changed, 628 insertions(+), 14 deletions(-) delete mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-Fix_searching_of_afpfsd.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-gcrypt.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-02-pointer.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-04-boxee1.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-05-boxee2.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-06-boxee3.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-07-boxee4.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-08-boxee5.patch create mode 100644 packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-10-fix-errno.patch diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-Fix_searching_of_afpfsd.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-Fix_searching_of_afpfsd.patch deleted file mode 100644 index 6de072ea77..0000000000 --- a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-Fix_searching_of_afpfsd.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -Naur afpfs-ng-0.8.1/fuse/client.c afpfs-ng-0.8.1.patch/fuse/client.c ---- afpfs-ng-0.8.1/fuse/client.c 2008-03-08 03:44:16.000000000 +0100 -+++ afpfs-ng-0.8.1.patch/fuse/client.c 2011-05-22 19:08:53.938152499 +0200 -@@ -61,8 +61,8 @@ - snprintf(filename, PATH_MAX, - "/usr/local/bin/%s",AFPFSD_FILENAME); - if (access(filename,X_OK)) { -- snprintf(filename, "/usr/bin/%s", -- AFPFSD_FILENAME); -+ snprintf(filename, PATH_MAX, -+ "/usr/bin/%s", AFPFSD_FILENAME); - if (access(filename,X_OK)) { - printf("Could not find server (%s)\n", - filename); diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-gcrypt.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-gcrypt.patch new file mode 100644 index 0000000000..2544bbef53 --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-01-gcrypt.patch @@ -0,0 +1,25 @@ +diff -Naur afpfs-ng-0.8.1/configure.ac afpfs-ng-0.8.1.patch/configure.ac +--- afpfs-ng-0.8.1/configure.ac 2011-09-10 12:14:34.164716403 +0200 ++++ afpfs-ng-0.8.1.patch/configure.ac 2011-09-10 12:15:13.266241771 +0200 +@@ -51,21 +51,6 @@ + case $host in + *-*-darwin*) + AC_MSG_CHECKING([for correct gcrypt version]) +- AC_RUN_IFELSE( +- [AC_LANG_PROGRAM([ +- #include +- #include ],[ +- char*p= GCRYPT_VERSION; +- unsigned int vers; +- vers=atoi(p)*10000; +- p=strchr(p,'.')+1; +- vers+=atoi(p)*100; +- p=strchr(p,'.')+1; +- vers+=atoi(p); +- if (vers<10400) return 1; +- ])], +- [AC_MSG_RESULT([yes])], +- [AC_MSG_ERROR([version is < 1.4.0])]) + AM_CONDITIONAL(HAVE_LIBGCRYPT, true) + AC_DEFINE([HAVE_LIBGCRYPT], [1] ) + ;; diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-02-pointer.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-02-pointer.patch new file mode 100644 index 0000000000..a1916c3306 --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-02-pointer.patch @@ -0,0 +1,280 @@ +diff -Naur afpfs-ng-0.8.1/cmdline/getstatus.c afpfs-ng-0.8.1.patch/cmdline/getstatus.c +--- afpfs-ng-0.8.1/cmdline/getstatus.c 2011-09-10 12:14:34.164716403 +0200 ++++ afpfs-ng-0.8.1.patch/cmdline/getstatus.c 2011-09-10 12:16:23.717188342 +0200 +@@ -1,4 +1,5 @@ + #include ++#include + #include + #include + +diff -Naur afpfs-ng-0.8.1/fuse/client.c afpfs-ng-0.8.1.patch/fuse/client.c +--- afpfs-ng-0.8.1/fuse/client.c 2011-09-10 12:14:34.165716416 +0200 ++++ afpfs-ng-0.8.1.patch/fuse/client.c 2011-09-10 12:16:23.737188610 +0200 +@@ -61,8 +61,9 @@ + snprintf(filename, PATH_MAX, + "/usr/local/bin/%s",AFPFSD_FILENAME); + if (access(filename,X_OK)) { +- snprintf(filename, "/usr/bin/%s", ++ snprintf(filename, sizeof(filename), "/usr/bin/%s", + AFPFSD_FILENAME); ++ filename[sizeof(filename) - 1] = 0; + if (access(filename,X_OK)) { + printf("Could not find server (%s)\n", + filename); +diff -Naur afpfs-ng-0.8.1/fuse/fuse_int.c afpfs-ng-0.8.1.patch/fuse/fuse_int.c +--- afpfs-ng-0.8.1/fuse/fuse_int.c 2011-09-10 12:14:34.167716442 +0200 ++++ afpfs-ng-0.8.1.patch/fuse/fuse_int.c 2011-09-10 12:16:23.745188717 +0200 +@@ -197,7 +197,7 @@ + ret = ml_open(volume,path,flags,&fp); + + if (ret==0) +- fi->fh=(void *) fp; ++ fi->fh=(unsigned long) fp; + + return ret; + } +diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/afp.h afpfs-ng-0.8.1.patch/include/afpfs-ng/afp.h +--- afpfs-ng-0.8.1/include/afpfs-ng/afp.h 2011-09-10 12:14:34.168716455 +0200 ++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/afp.h 2011-09-10 12:16:37.588374712 +0200 +@@ -370,7 +370,7 @@ + + int afp_opendt(struct afp_volume *volume, unsigned short * refnum); + +-int afp_closedt(struct afp_server * server, unsigned short * refnum); ++int afp_closedt(struct afp_server * server, unsigned short refnum); + + int afp_getcomment(struct afp_volume *volume, unsigned int did, + const char * pathname, struct afp_comment * comment); +diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/utils.h afpfs-ng-0.8.1.patch/include/afpfs-ng/utils.h +--- afpfs-ng-0.8.1/include/afpfs-ng/utils.h 2011-09-10 12:14:34.173716523 +0200 ++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/utils.h 2011-09-10 12:16:47.234504316 +0200 +@@ -8,8 +8,8 @@ + #define hton64(x) (x) + #define ntoh64(x) (x) + #else /* BYTE_ORDER == BIG_ENDIAN */ +-#define hton64(x) ((u_int64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \ +- (u_int64_t) ((htonl(x) & 0xffffffffLL) << 32)) ++#define hton64(x) ((u_int64_t) (htonl((((unsigned long long)(x)) >> 32) & 0xffffffffLL)) | \ ++ (u_int64_t) ((htonl((unsigned long long)(x)) & 0xffffffffLL) << 32)) + #define ntoh64(x) (hton64(x)) + #endif /* BYTE_ORDER == BIG_ENDIAN */ + +diff -Naur afpfs-ng-0.8.1/lib/afp_url.c afpfs-ng-0.8.1.patch/lib/afp_url.c +--- afpfs-ng-0.8.1/lib/afp_url.c 2011-09-10 12:14:34.182716644 +0200 ++++ afpfs-ng-0.8.1.patch/lib/afp_url.c 2011-09-10 12:16:47.235504329 +0200 +@@ -33,7 +33,7 @@ + static int check_uamname(const char * uam) + { + char * p; +- for (p=uam;*p;p++) { ++ for (p=(char *)uam;*p;p++) { + if (*p==' ') continue; + if ((*p<'A') || (*p>'z')) return -1; + } +@@ -188,7 +188,7 @@ + return -1; + + } +- if (p==NULL) p=toparse; ++ if (p==NULL) p=(char *)toparse; + + /* Now split on the first / */ + if (sscanf(p,"%[^/]/%[^$]", +diff -Naur afpfs-ng-0.8.1/lib/did.c afpfs-ng-0.8.1.patch/lib/did.c +--- afpfs-ng-0.8.1/lib/did.c 2011-09-10 12:14:34.184716670 +0200 ++++ afpfs-ng-0.8.1.patch/lib/did.c 2011-09-10 12:16:47.235504329 +0200 +@@ -226,7 +226,7 @@ + + + /* Go to the end of last known entry */ +- p=path+(p-copy); ++ p=(char *)path+(p-copy); + p2=p; + + while ((p=strchr(p+1,'/'))) { +diff -Naur afpfs-ng-0.8.1/lib/dsi.c afpfs-ng-0.8.1.patch/lib/dsi.c +--- afpfs-ng-0.8.1/lib/dsi.c 2011-09-10 12:14:34.185716683 +0200 ++++ afpfs-ng-0.8.1.patch/lib/dsi.c 2011-09-10 12:16:47.236504342 +0200 +@@ -474,7 +474,7 @@ + } + server->flags=ntohs(reply1->flags); + +- p=(void *)((unsigned int) server->incoming_buffer + sizeof(*reply1)); ++ p=(void *)((unsigned long) server->incoming_buffer + sizeof(*reply1)); + p+=copy_from_pascal(server->server_name,p,AFP_SERVER_NAME_LEN)+1; + + /* Now work our way through the variable bits */ +@@ -757,7 +757,7 @@ + printf("<<< read() of rest of AFP, %d bytes\n",amount_to_read); + #endif + ret = read(server->fd, (void *) +- (((unsigned int) server->incoming_buffer)+server->data_read), ++ (((unsigned long) server->incoming_buffer)+server->data_read), + amount_to_read); + if (ret<0) return -1; + if (ret==0) { +diff -Naur afpfs-ng-0.8.1/lib/loop.c afpfs-ng-0.8.1.patch/lib/loop.c +--- afpfs-ng-0.8.1/lib/loop.c 2011-09-10 12:14:34.186716697 +0200 ++++ afpfs-ng-0.8.1.patch/lib/loop.c 2011-09-10 12:16:47.257504624 +0200 +@@ -25,7 +25,7 @@ + static unsigned char exit_program=0; + + static pthread_t ending_thread; +-static pthread_t main_thread = NULL; ++static pthread_t main_thread = (pthread_t)NULL; + + static int loop_started=0; + static pthread_cond_t loop_started_condition; +diff -Naur afpfs-ng-0.8.1/lib/lowlevel.c afpfs-ng-0.8.1.patch/lib/lowlevel.c +--- afpfs-ng-0.8.1/lib/lowlevel.c 2011-09-10 12:14:34.186716697 +0200 ++++ afpfs-ng-0.8.1.patch/lib/lowlevel.c 2011-09-10 12:16:47.288505041 +0200 +@@ -582,7 +582,7 @@ + if (volume->server->using_version->av_number>=30) + stbuf->st_mode |= fp.unixprivs.permissions; + else +- set_nonunix_perms(stbuf,&fp); ++ set_nonunix_perms(&stbuf->st_mode,&fp); + + stbuf->st_uid=fp.unixprivs.uid; + stbuf->st_gid=fp.unixprivs.gid; +diff -Naur afpfs-ng-0.8.1/lib/midlevel.c afpfs-ng-0.8.1.patch/lib/midlevel.c +--- afpfs-ng-0.8.1/lib/midlevel.c 2011-09-10 12:14:34.189716738 +0200 ++++ afpfs-ng-0.8.1.patch/lib/midlevel.c 2011-09-10 12:16:47.316505416 +0200 +@@ -713,7 +713,7 @@ + { + + int ret,err=0; +- int totalwritten = 0; ++ size_t totalwritten = 0; + uint64_t sizetowrite, ignored; + unsigned char flags = 0; + unsigned int max_packet_size=volume->server->tx_quantum; +diff -Naur afpfs-ng-0.8.1/lib/proto_attr.c afpfs-ng-0.8.1.patch/lib/proto_attr.c +--- afpfs-ng-0.8.1/lib/proto_attr.c 2011-09-10 12:14:34.189716738 +0200 ++++ afpfs-ng-0.8.1.patch/lib/proto_attr.c 2011-09-10 12:16:47.317505429 +0200 +@@ -166,7 +166,7 @@ + copy_path(server,p,pathname,strlen(pathname)); + unixpath_to_afppath(server,p); + p2=p+sizeof_path_header(server)+strlen(pathname); +- if (((unsigned int ) p2) & 0x1) p2++; ++ if (((unsigned long) p2) & 0x1) p2++; + req2=(void *) p2; + + req2->len=htons(namelen); +diff -Naur afpfs-ng-0.8.1/lib/proto_desktop.c afpfs-ng-0.8.1.patch/lib/proto_desktop.c +--- afpfs-ng-0.8.1/lib/proto_desktop.c 2011-09-10 12:14:34.197716845 +0200 ++++ afpfs-ng-0.8.1.patch/lib/proto_desktop.c 2011-09-10 12:16:47.317505429 +0200 +@@ -168,7 +168,7 @@ + return 0; + } + +-int afp_closedt(struct afp_server * server, unsigned short * refnum) ++int afp_closedt(struct afp_server * server, unsigned short refnum) + { + struct { + struct dsi_header dsi_header __attribute__((__packed__)); +diff -Naur afpfs-ng-0.8.1/lib/proto_directory.c afpfs-ng-0.8.1.patch/lib/proto_directory.c +--- afpfs-ng-0.8.1/lib/proto_directory.c 2011-09-10 12:14:34.205716953 +0200 ++++ afpfs-ng-0.8.1.patch/lib/proto_directory.c 2011-09-10 12:16:47.317505429 +0200 +@@ -248,6 +248,7 @@ + + return 0; + } ++ + int afp_enumerateext2_reply(struct afp_server *server, char * buf, unsigned int size, void * other) + { + +@@ -266,8 +267,7 @@ + char * p = buf + sizeof(*reply); + int i; + char *max=buf+size; +- struct afp_file_info * filebase = NULL, *filecur=NULL, *new_file=NULL; +- void ** x = other; ++ struct afp_file_info * filebase = NULL, *filecur = NULL, *new_file = NULL, **x = (struct afp_file_info **) other; + + if (reply->dsi_header.return_code.error_code) { + return reply->dsi_header.return_code.error_code; +diff -Naur afpfs-ng-0.8.1/lib/proto_map.c afpfs-ng-0.8.1.patch/lib/proto_map.c +--- afpfs-ng-0.8.1/lib/proto_map.c 2011-09-10 12:14:34.207716979 +0200 ++++ afpfs-ng-0.8.1.patch/lib/proto_map.c 2011-09-10 12:16:47.318505443 +0200 +@@ -122,7 +122,7 @@ + + if (reply->header.return_code.error_code!=kFPNoErr) return -1; + +- copy_from_pascal_two(name,&reply->name,255); ++ copy_from_pascal_two(name,reply->name,255); + + return 0; + } +diff -Naur afpfs-ng-0.8.1/lib/proto_session.c afpfs-ng-0.8.1.patch/lib/proto_session.c +--- afpfs-ng-0.8.1/lib/proto_session.c 2011-09-10 12:14:34.208716992 +0200 ++++ afpfs-ng-0.8.1.patch/lib/proto_session.c 2011-09-10 12:16:47.318505443 +0200 +@@ -39,7 +39,7 @@ + switch (type) { + case kLoginWithTimeAndID: + case kReconnWithTimeAndID: { +- uint32_t *p = (void *) (((unsigned int) request)+ ++ uint32_t *p = (void *) (((unsigned long) request)+ + sizeof(*request)); + + offset=sizeof(timestamp); +@@ -63,7 +63,7 @@ + goto error; + } + +- data=(void *) (((unsigned int) request)+sizeof(*request)+offset); ++ data=(void *) (((unsigned long) request)+sizeof(*request)+offset); + request->idlength=htonl(datalen); + request->pad=0; + request->type=htons(type); +@@ -127,7 +127,7 @@ + if ((request=malloc(sizeof(*request) + AFP_TOKEN_MAX_LEN))==NULL) + return -1; + +- token_data = request + sizeof(*request); ++ token_data = (char *)request + sizeof(*request); + + request->type=htons(type); + +diff -Naur afpfs-ng-0.8.1/lib/uams.c afpfs-ng-0.8.1.patch/lib/uams.c +--- afpfs-ng-0.8.1/lib/uams.c 2011-09-10 12:14:34.212717047 +0200 ++++ afpfs-ng-0.8.1.patch/lib/uams.c 2011-09-10 12:16:47.319505457 +0200 +@@ -180,7 +180,7 @@ + goto cleartxt_fail; + + p += copy_to_pascal(p, username) + 1; +- if ((int)p & 0x1) ++ if ((long)p & 0x1) + len--; + else + p++; +@@ -230,7 +230,7 @@ + goto cleartxt_fail; + + p += copy_to_pascal(p, username) + 1; +- if ((int)p & 0x1) ++ if ((long)p & 0x1) + len--; + else + p++; +@@ -580,7 +580,7 @@ + if (ai == NULL) + goto dhx_noctx_fail; + d += copy_to_pascal(ai, username) + 1; +- if (((int)d) % 2) ++ if (((long)d) % 2) + d++; + else + ai_len--; +diff -Naur afpfs-ng-0.8.1/lib/utils.c afpfs-ng-0.8.1.patch/lib/utils.c +--- afpfs-ng-0.8.1/lib/utils.c 2011-09-10 12:14:34.213717060 +0200 ++++ afpfs-ng-0.8.1.patch/lib/utils.c 2011-09-10 12:16:47.319505457 +0200 +@@ -196,7 +196,7 @@ + maxlen=255; + + +- p=filename+1; ++ p=(char *)filename+1; + while ((q=strchr(p,'/'))) { + if (q>p+maxlen) + return 1; diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-04-boxee1.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-04-boxee1.patch new file mode 100644 index 0000000000..f50e6a7438 --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-04-boxee1.patch @@ -0,0 +1,26 @@ +diff -Naur afpfs-ng-0.8.1/include/afpfs-ng/dsi.h afpfs-ng-0.8.1.patch/include/afpfs-ng/dsi.h +--- afpfs-ng-0.8.1/include/afpfs-ng/dsi.h 2011-09-10 12:14:34.170716482 +0200 ++++ afpfs-ng-0.8.1.patch/include/afpfs-ng/dsi.h 2011-09-10 12:22:28.790093211 +0200 +@@ -6,13 +6,15 @@ + + struct dsi_request + { +- unsigned short requestid; +- unsigned char subcommand; +- void * other; +- unsigned char wait; +- pthread_cond_t condition_cond; +- struct dsi_request * next; +- int return_code; ++ unsigned short requestid; ++ unsigned char subcommand; ++ void * other; ++ int wait; ++ int done_waiting; ++ pthread_cond_t waiting_cond; ++ pthread_mutex_t waiting_mutex; ++ struct dsi_request * next; ++ int return_code; + }; + + int dsi_receive(struct afp_server * server, void * data, int size); diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-05-boxee2.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-05-boxee2.patch new file mode 100644 index 0000000000..a952302a91 --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-05-boxee2.patch @@ -0,0 +1,90 @@ +diff -Naur afpfs-ng-0.8.1/lib/afp.c afpfs-ng-0.8.1.patch/lib/afp.c +--- afpfs-ng-0.8.1/lib/afp.c 2011-09-10 12:14:34.181716631 +0200 ++++ afpfs-ng-0.8.1.patch/lib/afp.c 2011-09-10 12:23:15.935726602 +0200 +@@ -68,7 +68,7 @@ + afp_getsessiontoken_reply,afp_blank_reply, NULL, NULL, + afp_enumerateext2_reply, NULL, NULL, NULL, /*64 - 71 */ + afp_listextattrs_reply, NULL, NULL, NULL, +- afp_blank_reply, NULL, NULL, NULL, /*72 - 79 */ ++ afp_blank_reply, NULL, afp_blank_reply, afp_blank_reply, /*72 - 79 */ + + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, +@@ -320,8 +320,16 @@ + + struct dsi_request * p; + struct afp_server *s2; ++ ++ ++ if (s==NULL) ++ goto out; ++ + for (p=s->command_requests;p;p=p->next) { +- pthread_cond_signal(&p->condition_cond); ++ pthread_mutex_lock(&p->waiting_mutex); ++ p->done_waiting=1; ++ pthread_cond_signal(&p->waiting_cond); ++ pthread_mutex_unlock(&p->waiting_mutex); + } + + if (s==server_base) { +@@ -354,7 +362,7 @@ + s->exit_flag = 0; + s->path_encoding=kFPUTF8Name; /* This is a default */ + s->next=NULL; +- s->bufsize=2048; ++ s->bufsize=4096; + s->incoming_buffer=malloc(s->bufsize); + + s->attention_quantum=AFP_DEFAULT_ATTENTION_QUANTUM; +@@ -524,13 +532,14 @@ + kFPVolCreateDateBit|kFPVolIDBit | + kFPVolNameBit; + char new_encoding; ++ int ret; + + if (server->using_version->av_number>=30) + bitmap|= kFPVolNameBit|kFPVolBlockSizeBit; + +- switch (afp_volopen(volume,bitmap, +- (strlen(volume->volpassword)>0) ? volume->volpassword : NULL)) +- { ++ ret = afp_volopen(volume,bitmap, ++ (strlen(volume->volpassword)>0) ? volume->volpassword : NULL); ++ switch(ret){ + case kFPAccessDenied: + *l+=snprintf(mesg,max-*l, + "Incorrect volume password\n"); +@@ -544,6 +553,10 @@ + *l+=snprintf(mesg,max-*l, + "Could not open volume\n"); + goto error; ++ case ETIMEDOUT: ++ *l+=snprintf(mesg,max-*l, ++ "Timed out waiting to open volume\n"); ++ goto error; + } + + /* It is said that if a volume's encoding will be the same +@@ -641,7 +654,6 @@ + add_server(server); + + add_fd_and_signal(server->fd); +- + if (!full) { + return 0; + } +@@ -649,10 +661,13 @@ + /* Get the status, and calculate the transmit time. We use this to + * calculate our rx quantum. */ + gettimeofday(&t1,NULL); ++ + if ((error=dsi_getstatus(server))!=0) + goto error; + gettimeofday(&t2,NULL); + ++ afp_server_identify(server); ++ + if ((t2.tv_sec - t1.tv_sec) > 0) + server->tx_delay= (t2.tv_sec - t1.tv_sec) * 1000; + else diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-06-boxee3.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-06-boxee3.patch new file mode 100644 index 0000000000..7d17a7837c --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-06-boxee3.patch @@ -0,0 +1,142 @@ +diff -Naur afpfs-ng-0.8.1/lib/dsi.c afpfs-ng-0.8.1.patch/lib/dsi.c +--- afpfs-ng-0.8.1/lib/dsi.c 2011-09-10 12:21:39.948437027 +0200 ++++ afpfs-ng-0.8.1.patch/lib/dsi.c 2011-09-10 12:25:57.688903825 +0200 +@@ -64,7 +64,7 @@ + rx.size=0; + dsi_setup_header(server,&header,DSI_DSIGetStatus); + /* We're intentionally ignoring the results */ +- ret=dsi_send(server,(char *) &header,sizeof(struct dsi_header),20, ++ ret=dsi_send(server,(char *) &header,sizeof(struct dsi_header),60, + 0,(void *) &rx); + + free(rx.data); +@@ -197,6 +197,7 @@ + new_request->other=other; + new_request->wait=wait; + new_request->next=NULL; ++ new_request->done_waiting=0; + + pthread_mutex_lock(&server->request_queue_mutex); + if (server->command_requests==NULL) { +@@ -208,7 +209,8 @@ + server->stats.requests_pending++; + pthread_mutex_unlock(&server->request_queue_mutex); + +- pthread_cond_init(&new_request->condition_cond,NULL); ++ pthread_cond_init(&new_request->waiting_cond,NULL); ++ pthread_mutex_init(&new_request->waiting_mutex,NULL); + + if (server->connect_state==SERVER_STATE_DISCONNECTED) { + char mesg[1024]; +@@ -240,16 +242,12 @@ + server->stats.tx_bytes+=size; + pthread_mutex_unlock(&server->send_mutex); + +- int tmpwait=new_request->wait; + #ifdef DEBUG_DSI + printf("=== Waiting for response for %d %s\n", + new_request->requestid, + afp_get_command_name(new_request->subcommand)); + #endif +- if (tmpwait<0) { +- +- pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +- pthread_mutex_lock(&mutex); ++ if (new_request->wait<0) { + + /* Wait forever */ + #ifdef DEBUG_DSI +@@ -258,14 +256,17 @@ + afp_get_command_name(new_request->subcommand)); + #endif + +- rc=pthread_cond_wait( +- &new_request->condition_cond, +- &mutex ); +- pthread_mutex_unlock(&mutex); +- +- } else if (tmpwait>0) { +- pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +- pthread_mutex_lock(&mutex); ++ pthread_mutex_lock(&new_request->waiting_mutex); ++ ++ if (new_request->done_waiting==0) ++ rc=pthread_cond_wait( ++ &new_request->waiting_cond, ++ &new_request->waiting_mutex ); ++ ++ pthread_mutex_unlock(&new_request->waiting_mutex); ++ ++ } else if (new_request->wait>0) { ++ /* wait for new_request->wait seconds */ + + #ifdef DEBUG_DSI + printf("=== Waiting for %d %s, for %ds\n", +@@ -283,13 +284,15 @@ + printf("=== Changing my mind, no longer waiting for %d\n", + new_request->requestid); + #endif +- pthread_mutex_unlock(&mutex); + goto skip; + } +- rc=pthread_cond_timedwait( +- &new_request->condition_cond, +- &mutex,&ts); +- pthread_mutex_unlock(&mutex); ++ pthread_mutex_lock(&new_request->waiting_mutex); ++ if (new_request->done_waiting==0) ++ rc=pthread_cond_timedwait( ++ &new_request->waiting_cond, ++ &new_request->waiting_mutex,&ts); ++ pthread_mutex_unlock(&new_request->waiting_mutex); ++ + if (rc==ETIMEDOUT) { + /* FIXME: should handle this case properly */ + #ifdef DEBUG_DSI +@@ -299,6 +302,7 @@ + goto out; + } + } else { ++ /* Don't wait */ + #ifdef DEBUG_DSI + printf("=== Skipping wait altogether for %d\n",new_request->requestid); + #endif +@@ -474,7 +478,7 @@ + } + server->flags=ntohs(reply1->flags); + +- p=(void *)((unsigned long) server->incoming_buffer + sizeof(*reply1)); ++ p=(void *)((unsigned int) server->incoming_buffer + sizeof(*reply1)); + p+=copy_from_pascal(server->server_name,p,AFP_SERVER_NAME_LEN)+1; + + /* Now work our way through the variable bits */ +@@ -577,6 +581,7 @@ + unsigned char mins=0; + unsigned char checkmessage=0; + ++ memset(mesg,0,AFP_LOGINMESG_LEN); + + /* The logic here's undocumented. If we get an attention packet and + there's no flag, then go check the message. Also, go check the +@@ -757,7 +762,7 @@ + printf("<<< read() of rest of AFP, %d bytes\n",amount_to_read); + #endif + ret = read(server->fd, (void *) +- (((unsigned long) server->incoming_buffer)+server->data_read), ++ (((unsigned int) server->incoming_buffer)+server->data_read), + amount_to_read); + if (ret<0) return -1; + if (ret==0) { +@@ -862,8 +867,11 @@ + #ifdef DEBUG_DSI + printf("<<< Signalling %d, returning %d or %d\n",request->requestid,request->return_code,rc); + #endif ++ pthread_mutex_lock(&request->waiting_mutex); + request->wait=0; +- pthread_cond_signal(&request->condition_cond); ++ request->done_waiting=1; ++ pthread_cond_signal(&request->waiting_cond); ++ pthread_mutex_unlock(&request->waiting_mutex); + } else { + dsi_remove_from_request_queue(server,request); + } diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-07-boxee4.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-07-boxee4.patch new file mode 100644 index 0000000000..e5ce7d1af1 --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-07-boxee4.patch @@ -0,0 +1,28 @@ +diff -Naur afpfs-ng-0.8.1/lib/identify.c afpfs-ng-0.8.1.patch/lib/identify.c +--- afpfs-ng-0.8.1/lib/identify.c 1970-01-01 01:00:00.000000000 +0100 ++++ afpfs-ng-0.8.1.patch/lib/identify.c 2011-09-10 12:26:30.257389169 +0200 +@@ -0,0 +1,24 @@ ++#include ++#include "afpfs-ng/afp.h" ++ ++ ++/* ++ * afp_server_identify() ++ * ++ * Identifies a server ++ * ++ * Right now, this only does identification using the machine_type ++ * given in getsrvrinfo, but this could later use mDNS to get ++ * more details. ++ */ ++void afp_server_identify(struct afp_server * s) ++{ ++ if (strcmp(s->machine_type,"Netatalk")==0) ++ s->server_type=AFPFS_SERVER_TYPE_NETATALK; ++ else if (strcmp(s->machine_type,"AirPort")==0) ++ s->server_type=AFPFS_SERVER_TYPE_AIRPORT; ++ else if (strcmp(s->machine_type,"Macintosh")==0) ++ s->server_type=AFPFS_SERVER_TYPE_MACINTOSH; ++ else ++ s->server_type=AFPFS_SERVER_TYPE_UNKNOWN; ++} diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-08-boxee5.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-08-boxee5.patch new file mode 100644 index 0000000000..3605626a5e --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-08-boxee5.patch @@ -0,0 +1,12 @@ +diff -Naur afpfs-ng-0.8.1/lib/Makefile.am afpfs-ng-0.8.1.patch/lib/Makefile.am +--- afpfs-ng-0.8.1/lib/Makefile.am 2008-02-18 04:34:32.000000000 +0100 ++++ afpfs-ng-0.8.1.patch/lib/Makefile.am 2011-09-10 12:27:09.833978612 +0200 +@@ -4,7 +4,7 @@ + + lib_LTLIBRARIES = libafpclient.la + +-libafpclient_la_SOURCES = afp.c codepage.c did.c dsi.c map_def.c uams.c uams_def.c unicode.c users.c utils.c resource.c log.c client.c server.c connect.c loop.c midlevel.c proto_attr.c proto_desktop.c proto_directory.c proto_files.c proto_fork.c proto_login.c proto_map.c proto_replyblock.c proto_server.c proto_volume.c proto_session.c afp_url.c status.c forklist.c debug.c lowlevel.c ++libafpclient_la_SOURCES = afp.c codepage.c did.c dsi.c map_def.c uams.c uams_def.c unicode.c users.c utils.c resource.c log.c client.c server.c connect.c loop.c midlevel.c proto_attr.c proto_desktop.c proto_directory.c proto_files.c proto_fork.c proto_login.c proto_map.c proto_replyblock.c proto_server.c proto_volume.c proto_session.c afp_url.c status.c forklist.c debug.c lowlevel.c identify.c + + # libafpclient_la_LDFLAGS = -module -avoid-version + diff --git a/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-10-fix-errno.patch b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-10-fix-errno.patch new file mode 100644 index 0000000000..d53d8e8a2d --- /dev/null +++ b/packages/network/afpfs-ng/patches/afpfs-ng-0.8.1-10-fix-errno.patch @@ -0,0 +1,25 @@ +diff -Naur afpfs-ng-0.8.1/lib/afp.c afpfs-ng-0.8.1.patch/lib/afp.c +--- afpfs-ng-0.8.1/lib/afp.c 2011-09-10 12:23:38.207025811 +0200 ++++ afpfs-ng-0.8.1.patch/lib/afp.c 2011-09-10 12:30:20.305810381 +0200 +@@ -19,7 +19,6 @@ + #include + #include + #include +-#include + + #include "afpfs-ng/afp_protocol.h" + #include "afpfs-ng/libafpclient.h" +diff -Naur afpfs-ng-0.8.1/lib/afp_url.c afpfs-ng-0.8.1.patch/lib/afp_url.c +--- afpfs-ng-0.8.1/lib/afp_url.c 2011-09-10 12:21:39.946437001 +0200 ++++ afpfs-ng-0.8.1.patch/lib/afp_url.c 2011-09-10 12:30:20.306810396 +0200 +@@ -21,7 +21,9 @@ + + static int check_port(char * port) + { +- long long ret = strtol(port,NULL,10); ++ long long ret = 0; ++ errno = 0; ++ ret = strtol(port,NULL,10); + if ((ret<0) || (ret>32767)) return -1; + if (errno) { + printf("port error\n");