From 017a8877f5c78435ba7d9726f4438eb24e4444c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 19 Jan 2015 23:35:56 +0200 Subject: [PATCH] new, version 0.8.1 based on fedora package 4416edf --- afpfs-ng.spec | 107 ++++++++++++++++++ formatsec.patch | 161 ++++++++++++++++++++++++++++ overflows.patch | 28 +++++ pointer.patch | 280 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 576 insertions(+) create mode 100644 afpfs-ng.spec create mode 100644 formatsec.patch create mode 100644 overflows.patch create mode 100644 pointer.patch diff --git a/afpfs-ng.spec b/afpfs-ng.spec new file mode 100644 index 0000000..7cff508 --- /dev/null +++ b/afpfs-ng.spec @@ -0,0 +1,107 @@ +# +# Conditional build: +%bcond_without fuse # FUSE driver for AFP filesystem + +Summary: Apple Filing Protocol client +Name: afpfs-ng +Version: 0.8.1 +Release: 1 +License: GPL+ +Group: Base +Source0: http://downloads.sourceforge.net/afpfs-ng/%{name}-%{version}.tar.bz2 +# Source0-md5: 1bdd9f8a06e6085ea4cc38ce010ef60b +URL: https://sites.google.com/site/alexthepuffin/ +Patch0: overflows.patch +Patch1: pointer.patch +Patch2: formatsec.patch +BuildRequires: gmp-devel +BuildRequires: libgcrypt-devel +BuildRequires: readline-devel +%if %{with fuse} +BuildRequires: libfuse-devel +Suggests: fuse-afp +%endif +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +A command line client to access files exported from Mac OS system via +Apple Filing Protocol. + +%package -n fuse-afp +Summary: FUSE driver for AFP filesystem +Group: Base + +%description -n fuse-afp +A FUSE file system server to access files exported from Mac OS system +via AppleTalk or TCP using Apple Filing Protocol. The command line +client for AFP is in fuse-afp package + +%package devel +Summary: Development files for afpfs-ng +Group: Development/Libraries +Requires: %{name} = %{version} + +%description devel +Library for dynamic linking and header files of afpfs-ng. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 + +# make would rebuild the autoconf infrastructure due to the following: +# Prerequisite `configure.ac' is newer than target `Makefile.in'. +# Prerequisite `aclocal.m4' is newer than target `Makefile.in'. +# Prerequisite `configure.ac' is newer than target `aclocal.m4'. +touch --reference aclocal.m4 configure.ac Makefile.in + +%build +%configure \ + %{!?with_fuse:--disable-fuse} \ + --disable-static +%{__make} + +%install +rm -rf $RPM_BUILD_ROOT +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT + +%{__rm} $RPM_BUILD_ROOT%{_libdir}/libafpclient.la + +install -d $RPM_BUILD_ROOT%{_includedir}/afpfs-ng +cp -p include/* $RPM_BUILD_ROOT%{_includedir}/afpfs-ng + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(644,root,root,755) +%doc COPYING AUTHORS ChangeLog docs/README docs/performance docs/FEATURES.txt docs/REPORTING-BUGS.txt +%attr(755,root,root) %{_bindir}/afpcmd +%attr(755,root,root) %{_bindir}/afpgetstatus +%{_mandir}/man1/afpcmd.1* +%{_mandir}/man1/afpgetstatus.1* +%attr(755,root,root) %{_libdir}/libafpclient.so.0.0.0 +%ghost %{_libdir}/libafpclient.so.0 + +%files devel +%defattr(644,root,root,755) +%{_includedir}/afpfs-ng +%{_libdir}/libafpclient.so + +%if %{with fuse} +%files -n fuse-afp +%defattr(644,root,root,755) +%doc COPYING AUTHORS ChangeLog +%attr(755,root,root) %{_bindir}/afp_client +%attr(755,root,root) %{_bindir}/afpfs +%attr(755,root,root) %{_bindir}/afpfsd +%attr(755,root,root) %{_bindir}/mount_afp +%{_mandir}/man1/afp_client.1* +%{_mandir}/man1/afpfsd.1* +%{_mandir}/man1/mount_afp.1* +%endif diff --git a/formatsec.patch b/formatsec.patch new file mode 100644 index 0000000..74a09d6 --- /dev/null +++ b/formatsec.patch @@ -0,0 +1,161 @@ +Sent by e-mail to Alex deVries + +From 2c76660566d026d430305231e72c259372de4380 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Wed, 4 Dec 2013 23:17:10 +0100 +Subject: [PATCH] Fix build with -Werror=format-security + +Fedora, starting with version 21, will enable this flag in order to limit +potentially insecure uses of format strings. It is required for format strings +to be constant now. +--- + cmdline/cmdline_afp.c | 4 ++-- + cmdline/cmdline_testafp.c | 12 ++++++------ + fuse/client.c | 5 +---- + fuse/commands.c | 4 ++-- + lib/afp_url.c | 12 ++++++------ + 5 files changed, 17 insertions(+), 20 deletions(-) + +diff --git a/cmdline/cmdline_afp.c b/cmdline/cmdline_afp.c +index 827150b..59f0977 100644 +--- a/cmdline/cmdline_afp.c ++++ b/cmdline/cmdline_afp.c +@@ -828,11 +828,11 @@ int com_status(char * arg) + char text[40960]; + + afp_status_header(text,&len); +- printf(text); ++ printf("%s", text); + + len=40960; + afp_status_server(server,text,&len); +- printf(text); ++ printf("%s", text); + return 0; + } + +diff --git a/cmdline/cmdline_testafp.c b/cmdline/cmdline_testafp.c +index c40f2bd..f887aec 100644 +--- a/cmdline/cmdline_testafp.c ++++ b/cmdline/cmdline_testafp.c +@@ -26,12 +26,12 @@ static int test_one_url(char * url_string, + struct afp_url valid_url; + afp_default_url(&valid_url); + valid_url.protocol=protocol; +- sprintf(valid_url.servername,servername); +- sprintf(valid_url.volumename,volumename); +- sprintf(valid_url.path,path); +- sprintf(valid_url.username,username); +- sprintf(valid_url.password,password); +- sprintf(valid_url.uamname,uamname); ++ snprintf(valid_url.servername,sizeof(valid_url.servername),"%s",servername); ++ snprintf(valid_url.volumename,sizeof(valid_url.volumename),"%s",volumename); ++ snprintf(valid_url.path,sizeof(valid_url.path),"%s",path); ++ snprintf(valid_url.username,sizeof(valid_url.username),"%s",username); ++ snprintf(valid_url.password,sizeof(valid_url.password),"%s",password); ++ snprintf(valid_url.uamname,(valid_url.uamname),"%s",uamname); + valid_url.port=port; + + if (afp_url_validate(url_string,&valid_url)) +diff --git a/fuse/client.c b/fuse/client.c +index f795ca6..d19e9ef 100644 +--- a/fuse/client.c ++++ b/fuse/client.c +@@ -509,7 +509,6 @@ static int prepare_buffer(int argc, char * argv[]) + int read_answer(int sock) { + int len=0, expected_len=0, packetlen; + char incoming_buffer[MAX_CLIENT_RESPONSE]; +- char toprint[MAX_CLIENT_RESPONSE+200]; + struct timeval tv; + fd_set rds,ords; + int ret; +@@ -546,9 +545,7 @@ int read_answer(int sock) { + } + + done: +- memset(toprint,0,MAX_CLIENT_RESPONSE+200); +- snprintf(toprint,MAX_CLIENT_RESPONSE+200,"%s",incoming_buffer+sizeof(*answer)); +- printf(toprint); ++ printf("%.200s",incoming_buffer+sizeof(*answer)); + return ((struct afp_server_response *) incoming_buffer)->result; + + return 0; +diff --git a/fuse/commands.c b/fuse/commands.c +index aa7444d..bb06928 100644 +--- a/fuse/commands.c ++++ b/fuse/commands.c +@@ -163,6 +163,7 @@ static void fuse_log_for_client(void * priv, + len = strlen(c->client_string); + snprintf(c->client_string+len, + MAX_CLIENT_RESPONSE-len, ++ "%s", + message); + } else { + +@@ -468,7 +468,7 @@ static int process_mount(struct fuse_client * c) + volume->mapping=req->map; + afp_detect_mapping(volume); + +- snprintf(volume->mountpoint,255,req->mountpoint); ++ snprintf(volume->mountpoint,255,"%s",req->mountpoint); + + /* Create the new thread and block until we get an answer back */ + { +diff --git a/lib/afp_url.c b/lib/afp_url.c +index 42bac1c..f152d7b 100644 +--- a/lib/afp_url.c ++++ b/lib/afp_url.c +@@ -233,7 +233,7 @@ int afp_parse_url(struct afp_url * url, const char * toparse, int verbose) + } + } + +- snprintf(url->servername,strlen(p)+1,p); ++ snprintf(url->servername,strlen(p)+1,"%s",p); + if (check_servername(url->servername)) { + if (verbose) printf("This isn't a valid servername\n"); + return -1; +@@ -263,7 +263,7 @@ int afp_parse_url(struct afp_url * url, const char * toparse, int verbose) + if ((q=escape_strrchr(p,':',":"))) { + *q='\0'; + q++; +- snprintf(url->password,strlen(q)+1,q); ++ snprintf(url->password,strlen(q)+1,"%s",q); + if (check_password(url->password)) { + if (verbose) printf("This isn't a valid passwd\n"); + return -1; +@@ -276,7 +276,7 @@ int afp_parse_url(struct afp_url * url, const char * toparse, int verbose) + if ((q=strstr(p,";AUTH="))) { + *q='\0'; + q+=6; +- snprintf(url->uamname,strlen(q)+1,q); ++ snprintf(url->uamname,strlen(q)+1,"%s",q); + if (check_uamname(url->uamname)) { + if (verbose) printf("This isn't a valid uamname\n"); + return -1; +@@ -284,7 +284,7 @@ int afp_parse_url(struct afp_url * url, const char * toparse, int verbose) + } + + if (strlen(p)>0) { +- snprintf(url->username,strlen(p)+1,p); ++ snprintf(url->username,strlen(p)+1,"%s",p); + if (check_username(url->username)) { + if (verbose) printf("This isn't a valid username\n"); + return -1;; +@@ -304,12 +304,12 @@ parse_secondpart: + *q='\0'; + q++; + } +- snprintf(url->volumename,strlen(p)+1,p); ++ snprintf(url->volumename,strlen(p)+1,"%s",p); + + + if (q) { + url->path[0]='/'; +- snprintf(url->path+1,strlen(q)+1,q); ++ snprintf(url->path+1,strlen(q)+1,"%s",q); + } + + done: +-- +1.8.4.2 + diff --git a/overflows.patch b/overflows.patch new file mode 100644 index 0000000..94399ed --- /dev/null +++ b/overflows.patch @@ -0,0 +1,28 @@ +Fix possible buffer overflows (given we're copying to storage of AFP_MAX_PATH, +while AFP_MAX_PATH is much smaller than PATH_MAX) + +Lubomir Rintel + +--- afpfs-ng-0.8.1/cmdline/cmdline_afp.c.overflows 2008-10-06 19:21:32.000000000 +0200 ++++ afpfs-ng-0.8.1/cmdline/cmdline_afp.c 2008-10-06 19:13:50.000000000 +0200 +@@ -129,9 +129,9 @@ + { + if (filename[0]!='/') { + if (strlen(curdir)==1) +- snprintf(server_fullname,PATH_MAX,"/%s",filename); ++ snprintf(server_fullname,AFP_MAX_PATH,"/%s",filename); + else +- snprintf(server_fullname,PATH_MAX,"%s/%s",curdir,filename); ++ snprintf(server_fullname,AFP_MAX_PATH,"%s/%s",curdir,filename); + } else { + snprintf(server_fullname,PATH_MAX,"%s",filename); + } +@@ -1217,7 +1217,7 @@ + { + struct passwd * passwd; + +- snprintf(curdir,PATH_MAX,"%s",DEFAULT_DIRECTORY); ++ snprintf(curdir,AFP_MAX_PATH,"%s",DEFAULT_DIRECTORY); + if (init_uams()<0) return -1; + + afp_default_url(&url); diff --git a/pointer.patch b/pointer.patch new file mode 100644 index 0000000..b47b834 --- /dev/null +++ b/pointer.patch @@ -0,0 +1,280 @@ +diff -up afpfs-ng-0.8.1/cmdline/getstatus.c.pointer afpfs-ng-0.8.1/cmdline/getstatus.c +--- afpfs-ng-0.8.1/cmdline/getstatus.c.pointer 2011-06-14 17:06:35.000000000 +0200 ++++ afpfs-ng-0.8.1/cmdline/getstatus.c 2011-06-14 17:07:25.000000000 +0200 +@@ -1,4 +1,5 @@ + #include ++#include + #include + #include + +diff -up afpfs-ng-0.8.1/fuse/client.c.pointer afpfs-ng-0.8.1/fuse/client.c +--- afpfs-ng-0.8.1/fuse/client.c.pointer 2008-03-08 03:44:16.000000000 +0100 ++++ afpfs-ng-0.8.1/fuse/client.c 2011-06-14 17:02:15.000000000 +0200 +@@ -61,8 +61,9 @@ static int start_afpfsd(void) + 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 -up afpfs-ng-0.8.1/fuse/fuse_int.c.pointer afpfs-ng-0.8.1/fuse/fuse_int.c +--- afpfs-ng-0.8.1/fuse/fuse_int.c.pointer 2008-03-02 06:06:24.000000000 +0100 ++++ afpfs-ng-0.8.1/fuse/fuse_int.c 2011-06-14 17:02:15.000000000 +0200 +@@ -197,7 +197,7 @@ static int fuse_open(const char *path, s + ret = ml_open(volume,path,flags,&fp); + + if (ret==0) +- fi->fh=(void *) fp; ++ fi->fh=(unsigned long) fp; + + return ret; + } +diff -up afpfs-ng-0.8.1/include/afp.h.pointer afpfs-ng-0.8.1/include/afp.h +--- afpfs-ng-0.8.1/include/afp.h.pointer 2008-03-08 17:08:18.000000000 +0100 ++++ afpfs-ng-0.8.1/include/afp.h 2011-06-14 17:02:15.000000000 +0200 +@@ -370,7 +370,7 @@ int afp_unmount_all_volumes(struct afp_s + + 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 -up afpfs-ng-0.8.1/include/utils.h.pointer afpfs-ng-0.8.1/include/utils.h +--- afpfs-ng-0.8.1/include/utils.h.pointer 2008-02-18 04:33:58.000000000 +0100 ++++ afpfs-ng-0.8.1/include/utils.h 2011-06-14 17:02:15.000000000 +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 -up afpfs-ng-0.8.1/lib/afp_url.c.pointer afpfs-ng-0.8.1/lib/afp_url.c +--- afpfs-ng-0.8.1/lib/afp_url.c.pointer 2008-03-04 21:16:49.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/afp_url.c 2011-06-14 17:02:15.000000000 +0200 +@@ -33,7 +33,7 @@ static int check_port(char * port) + 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 @@ int afp_parse_url(struct afp_url * url, + return -1; + + } +- if (p==NULL) p=toparse; ++ if (p==NULL) p=(char *)toparse; + + /* Now split on the first / */ + if (sscanf(p,"%[^/]/%[^$]", +diff -up afpfs-ng-0.8.1/lib/did.c.pointer afpfs-ng-0.8.1/lib/did.c +--- afpfs-ng-0.8.1/lib/did.c.pointer 2008-02-18 04:39:17.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/did.c 2011-06-14 17:02:15.000000000 +0200 +@@ -226,7 +226,7 @@ int get_dirid(struct afp_volume * volume + + + /* 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 -up afpfs-ng-0.8.1/lib/dsi.c.pointer afpfs-ng-0.8.1/lib/dsi.c +--- afpfs-ng-0.8.1/lib/dsi.c.pointer 2008-02-18 04:53:03.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/dsi.c 2011-06-14 17:02:15.000000000 +0200 +@@ -474,7 +474,7 @@ void dsi_getstatus_reply(struct afp_serv + } + 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 @@ gotenough: + 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 -up afpfs-ng-0.8.1/lib/loop.c.pointer afpfs-ng-0.8.1/lib/loop.c +--- afpfs-ng-0.8.1/lib/loop.c.pointer 2008-02-18 04:40:11.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/loop.c 2011-06-14 17:02:15.000000000 +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 -up afpfs-ng-0.8.1/lib/lowlevel.c.pointer afpfs-ng-0.8.1/lib/lowlevel.c +--- afpfs-ng-0.8.1/lib/lowlevel.c.pointer 2008-02-20 02:33:17.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/lowlevel.c 2011-06-14 17:02:15.000000000 +0200 +@@ -582,7 +582,7 @@ int ll_getattr(struct afp_volume * volum + 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 -up afpfs-ng-0.8.1/lib/midlevel.c.pointer afpfs-ng-0.8.1/lib/midlevel.c +--- afpfs-ng-0.8.1/lib/midlevel.c.pointer 2008-03-08 17:08:18.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/midlevel.c 2011-06-14 17:02:15.000000000 +0200 +@@ -713,7 +713,7 @@ int ml_write(struct afp_volume * volume, + { + + 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 -up afpfs-ng-0.8.1/lib/proto_attr.c.pointer afpfs-ng-0.8.1/lib/proto_attr.c +--- afpfs-ng-0.8.1/lib/proto_attr.c.pointer 2008-01-30 05:37:58.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/proto_attr.c 2011-06-14 17:02:15.000000000 +0200 +@@ -166,7 +166,7 @@ int afp_getextattr(struct afp_volume * v + 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 -up afpfs-ng-0.8.1/lib/proto_desktop.c.pointer afpfs-ng-0.8.1/lib/proto_desktop.c +--- afpfs-ng-0.8.1/lib/proto_desktop.c.pointer 2008-02-18 04:44:11.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/proto_desktop.c 2011-06-14 17:02:15.000000000 +0200 +@@ -168,7 +168,7 @@ int afp_getcomment_reply(struct afp_serv + 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 -up afpfs-ng-0.8.1/lib/proto_directory.c.pointer afpfs-ng-0.8.1/lib/proto_directory.c +--- afpfs-ng-0.8.1/lib/proto_directory.c.pointer 2008-02-19 03:39:29.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/proto_directory.c 2011-06-14 17:02:15.000000000 +0200 +@@ -248,6 +248,7 @@ int afp_enumerate_reply(struct afp_serve + + return 0; + } ++ + int afp_enumerateext2_reply(struct afp_server *server, char * buf, unsigned int size, void * other) + { + +@@ -266,8 +267,7 @@ int afp_enumerateext2_reply(struct afp_s + 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 -up afpfs-ng-0.8.1/lib/proto_map.c.pointer afpfs-ng-0.8.1/lib/proto_map.c +--- afpfs-ng-0.8.1/lib/proto_map.c.pointer 2008-01-30 05:37:59.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/proto_map.c 2011-06-14 17:02:15.000000000 +0200 +@@ -122,7 +122,7 @@ int afp_mapid_reply(struct afp_server *s + + 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 -up afpfs-ng-0.8.1/lib/proto_session.c.pointer afpfs-ng-0.8.1/lib/proto_session.c +--- afpfs-ng-0.8.1/lib/proto_session.c.pointer 2008-02-18 04:46:19.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/proto_session.c 2011-06-14 17:02:15.000000000 +0200 +@@ -39,7 +39,7 @@ int afp_getsessiontoken(struct afp_serve + 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 @@ int afp_getsessiontoken(struct afp_serve + 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 @@ int afp_disconnectoldsession(struct afp_ + 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 -up afpfs-ng-0.8.1/lib/uams.c.pointer afpfs-ng-0.8.1/lib/uams.c +--- afpfs-ng-0.8.1/lib/uams.c.pointer 2008-01-04 04:52:44.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/uams.c 2011-06-14 17:02:15.000000000 +0200 +@@ -180,7 +180,7 @@ static int cleartxt_login(struct afp_ser + 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 @@ static int cleartxt_passwd(struct afp_se + 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 @@ static int dhx_login(struct afp_server * + 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 -up afpfs-ng-0.8.1/lib/utils.c.pointer afpfs-ng-0.8.1/lib/utils.c +--- afpfs-ng-0.8.1/lib/utils.c.pointer 2008-02-18 04:53:37.000000000 +0100 ++++ afpfs-ng-0.8.1/lib/utils.c 2011-06-14 17:02:15.000000000 +0200 +@@ -196,7 +196,7 @@ int invalid_filename(struct afp_server * + maxlen=255; + + +- p=filename+1; ++ p=(char *)filename+1; + while ((q=strchr(p,'/'))) { + if (q>p+maxlen) + return 1; -- 2.43.0