first import, version 0.8.2

This commit is contained in:
Simon Vetter 2013-03-12 00:08:07 -07:00
parent 5a5eae2bdc
commit 93d871128c
138 changed files with 70230 additions and 3 deletions

18
AUTHORS Normal file
View File

@ -0,0 +1,18 @@
Simon Vetter <simon dot vetter at gmx dot com>
- ipv6 support
- multiple bug fixes
Various developers, Boxee, The XBMC project
- a ton of bug fixes
Alex deVries <alexthepuffin at gmail dot com>:
- started the project, wrote most of the code
- DSI and AFP protocol handling
- FUSE interfaces
- command line interfaces
Derrik Pates
- crypto UAMs
Michael Ulbrich
- UTF8 support

41
Bugs.txt Normal file
View File

@ -0,0 +1,41 @@
These are known bugs in afpfs-ng 0.8:
- this code definitely needs more testing...
- mounting a time capsule can result in a timeout while the disk starts spinning.
(mine takes more than 10 seconds to spin up). Retrying right after always succeeds.
- if afpfsd isnt' running, and you run an 'afp_client exit', it restarts it
and then kills it
- files with '/' in them can't be accessed
- for the fuse client, when you have multiple servers that are connected,
if you unmount anything other than the last one, you may ruin the
other mounts.
- If you're not using a common user directory, chgrp may have problems
- On occasion, when doing a mount with the fuse client, there can be a
delay of 10 seconds.
- there are some locking problems with FUSE which can cause a halted
filesystem under heavy traffic loads
- on Mac OS X, gcrypt 1.4.0 or later is required. 1.2.4 has a dynamic linker
bug which will break afpfs-ng whenver gcrypt functions are called.
- on file get and put, we don't really pay attention to tx and rx quantums.
This can make for inefficient transfers.
- FreeBSD has quite a few problems with it; the port is simply incomplete.
Among the problems:
- the fuse implementation is totaly untested, you will need to manually
start up the daemon (afpfsd)
- there can be some long delays when initiating connections
- on some clients, such as afpgetstatus, ^C won't work
- file names are limited to 255 characters, whereas AFP >= 3.0 handles
infinite lengths

340
COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

378
ChangeLog Normal file
View File

@ -0,0 +1,378 @@
March 11, 2013
- added ipv6 support
- included XBMC patches
- lots of fixes
- release 0.8.2
March 11, 2008
- added fstab support
- release 0.8.1
March 4, 2008
- added support for @ in passwords
January 16, 2008
- lots of fixes
January 12, 2008
- redid logging
- DSI wait times
January 10, 2008
- UAM handling
- ask for a password
January 8, 2008
- added getpass() support
- fixed up cmdline's disconnect
January 4, 2008
- fixed login messages
- fixed up URL parsing
January 3, 2008
- lots of cleanup
- replaced logging infrastructure
December 31, 2007
- now able to interrupt cmdline when transferring
December 30, 2007
- add a hack to the cmdline to handle ^c
December 29, 2007
- fixed afp_url parsing
- added connect command
December 27, 2007
- added df support for cmdline
December 26, 2007
- move status around so it is part of the library
December 23, 2007
- fixing chmod
- added cmdline's touch
December 22, 2007
- many, many changes.
November 9, 2007
- rewrote readdir()
- fixed up include files
October 17, 2007
- redo client code
October 10, 2007
- cleanup reconnect code, implement session tokens
October 5, 2007
- fixup include files
October 1, 2007
- add getsessiontoken
September 23, 2007
- made constant params in ml_ functions
- wrote the entire midlevel code, stripped out the fuse_int.c code
- implemented most of the afp commands
September 11, 2007
- simplify afp interface
- start midlevel interface starting with readdir
- cmdline now connects!
September 10, 2007
- rework of the entire tree; creation of lib/, fuse/ and cmdline
September 3, 2007
- really fixed up double .AppleDouble problem this time
- redid getstatus_reply handling for optional requirements
- UTF8 servernames work properly now
- uprev to 0.4.3
August 31, 2007
- fixed up detection of .AppleDouble/*/.AppleDouble, these are invalid
- fixed up signature handling
August 25, 2007
Added somewhat more correct gid handling.
Fixed up mknod uid/gid handling.
Some comments on uid/gid mapping.
The following only matters for mapping login ids.
gid handling seems to be handled somewhat differently between servers. When
doing a getuserinfo with the GROUPID bit set, you get:
- 10.4.7 replies with the field, but it contains junk
- Other mac os x and Airport 7.1.1 replies with an empty field
- netatalk fills it in as expected
Furthermore, it doesn't matter what you do with chgrp (or chmod or probably
chown) on an Airport, all files are owned by 0.0, 0777.
August 24, 2007
- added up some uid/gid debugging
August 18, 2007
- solved setforkparms problem, which was blowing up Airports.
- finally, sorted out strange problem whereby if you set the fuse servername
to have a special character, gnome-panel goes nuts.
August 17, 2007
- completed uid/gid mapping
August 8, 2007
- fixed gid/uid permissions problem in mknod
- print out built-in UAMs in status output for support
- added preliminary cleanup for netbsd
August 1, 2007
- rewrote all the code translation paths, so there are now simple hooks for
adding UTF8-MAC support.
- added hooks for volume name UTF8 support
- Derrik has fixed up a lot of the crypto work to add dhx2
- disabling the broken uid/gid translation for now
- fixed up ordering of including fuse.h
- took fixed start_afpfsd code from Volker Grabsch
Mar 31, 2007
- added Paul Borman's fix to ask for a password
- blanked out the uid/gid mapping since it currently breaks situations where
the uid and gid of the client and server don't match
- added a port option to the client (-o)
- changed the default FUSE version to 25, should solve lots of compile probs
Feb 11
- fixed DHCAST128's definition
Feb 9
- afp_client now correctly startsup afpfsd, including locating afpfsd
- backgrounding works properly now
- fixed syslog problem
- fuse only in debug mode when debug mode for afpfsd is on
Feb 8
- finally, fixed major memory leak
Feb 7
- now, you get a warning if you run afpfsd twice
- mounting works okay if we don't have LIBGMP
Feb 6
- fixed exit command
- fixed slow unmount problem
Feb 5
- fix of compiler warnings
- trying to track down this damned memory leak...
Feb 2
- various valgrind problems fixed
- fixed some problems with read around buffer splitting
- added UAM field in status output
- fixed chmodding on a directory
- From Derrik Pates, added:
- fixup to UAMs infrastructure
- Randnum Exchange
- 2-Way Randnum
- DHCAST128
- closed a few memory leaks
Jan 31
- added mutex around DSI requestid incrementing
Jan 30
- found and fixed problem with long reads with parallel builds/untars
Jan 29
- found and fixed problem with long reads with afpRead
Jan 28
- made ungranular locking
- all dirid references are relative now
- fixed afp_write
- submitted fix for fc6's netatalk
Jan 27
- use attention quantum properly in opensession
Jan 26
- should be 64-bit safe
- fixed unmount for real now
- on server shutdown, server state is resume
- fixed DSI_Attention packets
- on control-c, afpfsd unmounts and correctly disconnects
- if the server suddenly dies, we end up in a suspend mode
- if we're in suspend mode, we try to reconnect
- always free up in _release()
Jan 22
- fixed chmod behaviour if you have no ownership
Jan 19
- it's taken weeks, but signals and unmounting are finally fixed
Jan 9
- fixed nlink problem
Jan 7
- fixed slow mounting bugs
Jan 5
- completed did caching
- can now do recursive ls perfectly
Jan 4
- you can now compile afpfs-ng on itself
- wrote name/grp translation
- wrote MapName and MapID for name translations
Jan 3
- chgrp and chown probably work now
- start of generalized uid/gid translation hooks
- fixed minor client parsing problem
Jan 2
- fixed loginmsg problem
- start of automatic startup of afpfsd by the client
Jan 1
- fixed problem with large non-afpRead dsi packets, shown with large dir
entries against OS X
-
Dec 23
- fixed all the problems with get_dirid(), although it doesn't cache yet
- fixed mv, including when mv does a replacement
- you can now compile and configure afpfs-ng using afpfs-ng
Dec 20
- fixed .AppleDouble problem when removing an entire directory
- multithreaded, stripped out debug messages
- sorted out how to turn of debug messages
- fixed up a problem with dropped DSI messages (difficult)
Dec 19
- fixed afp_utime(), afp_open(), afp_read()
- fixed error messages for Connection refused
- fixed problem with unlink
Dec 15
- rewrote get_dirent()
- some funcs work against 3.2, for real now
Dec 14
- simplification of unmount code
- completed suspend/resume
Dec 9
- unmount now works
- completed rework for the threading model
- reworked uam tables
Dec 4
- fixed problem with displaying large directories
Nov 29, 2006
- comments should work now
- fixed symlink creation
- resource read and write completed
- handle runt packets properly
- completed comment handling
Nov 28, 2006
- start of comment, icon, resource special files
- start of symlinks (works)
- start of extended attributes
Nov 27, 2006
- release 0.3
-
Nov 23, 2006
- new uams infrastructure for more uams
- fixed many, many memory leaks
- fixed heap corruption problems
Nov 22, 2006
- fixed version requested problem
Nov 20, 2006
- fixed logging format problem
Nov 19, 2006
- released 0.2
- fixed problem with /bin/mount output
- doc cleanup
- autoconf
Nov 18, 2006
- fixed client printing problems
- multiframe DSI packets
- rewrote all of DSI packet handling to optimize for zero-copy reading and large buffer reading. Can now play MP3s.
- start of FUSE 2.6 compatibility
Nov 12, 2006
- dynamic quantum calculation
Nov 11, 2006
- fixed UTF8 names
- fixed large dids
Nov 10, 2006
- fixed writes on non-netatalk servers
Nov 9, 2006
- separate afpfs daemon and client
- daemon: handles multiple servers, multiple mounts
- new client handles status, mount, unmount
- handle unmount
Oct 18, 2006
- fixed rename
Oct 16, 2006
- release afpfs-ng version 0.1
Oct 13, 2006
- implemented rename
- fixed non-blocking AFP commands
- read only volumes
- volume passwords
Oct 11
- handle filename lengths
- handle open flags better
- completed general code cleanup, restructured some of the files
- implemented afp_byterangelock
Oct 8
- general code cleanup; got rid of lots of stale code
Oct 2
- wrote truncate
Oct 1
- got rid of KERNEL remnants
- actually reply to attention requests
- added cleartext passwords
- really fixed chmod files with all netatalk exceptions
- change the way we calculate volid
Sep 30
- figured out basic chmod stuff
- rewrote version handling
- rewrote volid handling
Sep 29
- fixed up threading problems, finally
- wrote incoming packet aggregator, so multiple DSI packets can come in on the same read
- moved DSI return codes to request

93
INSTALL Normal file
View File

@ -0,0 +1,93 @@
This is a quick guide on how to install afpfs-ng.
To get running:
1. Requirements
a) Linux
- libgcrypt, libgmp for the encrypted login methods
- readline for the command line client
- libfuse (2.7.0 or later) for the FUSE client
b) FreeBSD
- libgcrypt (1.4.0 or later), libgmp for the encrypted login methods
- libfuse (2.7.0 or later) for the untested FUSE client
- iconv
You'll want to configure with:
CFLAGS="-I/usr/local/include -L/usr/local/lib" ./configure
Testing is currently very weak.
c) Mac OS X
You'll need the developer kit and need to manually compile and install libgcrypt.
Only the command line client works.
Testing is currently very weak.
2. Compile afpfs-ng
tar -xzf afpfs-ng-0.8.tar.bz2
cd afpfs-ng-0.8.
./configure
make install
3. Running the FUSE client
This will let you mount remote filesystems.
As the user who will be needing to access, the file, run the management daemon
by running:
afpfsd
This should fork off. You should see messages in /var/log/messages. For more
details, run it with the '-d' option to see detailed debug info.
To mount a filesystem:
mount_afp "afp://username:password@servername/volumename" <mountpoint>
After this, you should be able to access files on <mountpoint>.
You can see status by running 'afp_client status'. See afp_client(1) for more info.
4. Running the command line client
There are two modes:
a) interactive mode
afpcmd is a command line tool like an FTP client.
Just run:
afpcmd "afp://username:password@servername/volumename"
(if you enter no volumename, it shows which ones are available. If you
provide no URL, you can use 'connect'. If you provide a '-' as the
password, you will be prompted for one interactively)
Available commands are:
get <filename>: retrieves the filename
get -r <dirname>: recursively retrieves the directory and its contents
put <filename>: send the file
dir: show directory listings
Others are available too; touch, chmod, chown, del, rename, etc. See
afpcmd(1) for more.
b) batch transfer
This will let you quickly transfer one file or recursively a directory,
and then return you to the command prompt.
Eg.
> afpcmd afp://user:pass@server/alexdevries/linux-2.6.14.tar.bz2
Connected to server Cubalibre using UAM "DHX2"
Connected to volume alexdevries
Getting file /linux-2.6.14.tar.bz2
Transferred 39172170 bytes in 2.862 seconds. (13687 kB/s)

5
Makefile.am Normal file
View File

@ -0,0 +1,5 @@
if HAVE_LIBFUSE
SUBDIRS = lib fuse cmdline include docs
else
SUBDIRS = lib cmdline include docs
endif

629
Makefile.in Normal file
View File

@ -0,0 +1,629 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
TODO compile config.guess config.sub depcomp install-sh \
ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = lib cmdline docs fuse
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYCLE_OBJ = @CYCLE_OBJ@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBFUSE_LDFLAGS = @LIBFUSE_LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@HAVE_LIBFUSE_FALSE@SUBDIRS = lib cmdline docs
@HAVE_LIBFUSE_TRUE@SUBDIRS = lib fuse cmdline docs
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d $(distdir) || mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am:
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

195
NEWS Normal file
View File

@ -0,0 +1,195 @@
What is new in afpfs-ng-0.8.2, March 11, 2013
--------------------------------------------
1. IPv6 support
The networking code has been updated to use getaddrinfo(). If a hostname is
provided in the URL, libafpclient will try to connect to every address in
the order in which they are returned, until a successful connection is made.
The URL parser supports ipv6 litterals (e.g. afp://[2001:db8::cafe]:548/Movies)
2. A ton of bug fixes.
This release includes all the patches collected by XBMC (http://xbmc.org/)
plus some more written by me.
Thanks to everyone who contributed to this project!
These patches have already been applied to the source and can be found in
afpfs-ng-0.8.2/patches/
What is new in afpfs-ng-0.8.1, March 8, 2008
--------------------------------------------
1. Read only support
You can mount volumes readonly with:
mount_afp -o ro afp://username:password@hostname/volumename /mountpoint
Per request from various people.
2. @ and : in passwords and usernames
For one @ in a password, use:
p@@ssword
For one : in a username, use:
user::name
Per request from Niclas Helbro.
3. Fstab
You can now automatically mount volumes in on boot with a line in fstab.
See docs/README, there are some simple but specific instructions.
What is new in afpfs-ng-0.8, February 18, 2008
----------------------------------------------
1. New command line (non-FUSE) tools:
a) batch mode of afpcmd
This lets you do simple transfers, eg.
> afpcmd afp://user:pass@server/alexdevries/linux-2.6.14.tar.bz2
Connected to server Cubalibre using UAM "DHX2"
Connected to volume alexdevries
Getting file /linux-2.6.14.tar.bz2
Transferred 39172170 bytes in 2.862 seconds. (13687 kB/s)
b) interactive mode of afpcmd
This is file transfer tool similiar to an ftp client. Has (local) filename
completion and command history.
c) get status tool, afpgetstatus
A simple tool to get the status information of a server without logging in.
2. FUSE client improvements
Continuation of FUSE client development, including the introduction of a new tool
called mount_afp, which has the same syntax as in Mac OS X. Better status and
post-deployment debugging, proper forced or unforced exit and other bugs.
3. Protocol fixes
Many protocol enhancements and bug fixes, including: support for AFP 2.x, multiple
servers, session keys, signatures, meta information, chmod and chown fixes.
Tested against Mac OS X, OS9, Airport and netatalk.
File transfer performance is now similiar or faster to Mac OS X.
4. Development library
The source code of afpfs-ng has now been changed to a library (libafpclient) and
support for multiple clients (examples are FUSE, afpcmd, afpgetstatus). With this
library, more AFP clients (GIO, KIO) can be built with limited pain. This API is
not yet stabilized.
5. Other
FUSE client fully validated on Linux, builds on FreeBSD.
Command line client builds and runs on Linux, runs but is weakly tested on FreeBSD
and Mac OS X.
There are manpages.
What is new in afpfs-ng-0.4.3, September 8, 2007
------------------------------------------------
New features in this release include:
- UTF8 internationalization of filenames, volumes and servers, mostly written by Michael Ulbrich
- proper uid/gid mapping to enable environments with a common or different user directory
- DHX2 UAM from Derrik Pates
- fixes to deal with the Apple Airport Extreme quirks
- fixes to deal with netatalk quirks
- improved status output for debugging
- various small bug fixes (Paul Borman, Volker Grabsch)
This is the last release before a rework that introduces libafpclient to
handle multiple clients.
You can get afpfs-ng from http://afpfs-ng.sourceforge.net .
What is new in afpfs-0.4, Feburary 11, 2007
-------------------------------------------
We're happy to release version 0.4 of afpfs-ng, the Apple Filing Protocol client
for Linux with FUSE.
New features include:
- stability: afpfs-ng is reliable to the point of being usable for all but
the most strenuous IO loads
- encrypted authentication mechanisms: now also supporting Randnum, 2-way
randnum, DHCAST128 and DHX2
- performance: DID caching, enhanced DSI packet processing and other
improvements make afpfs-ng about half as fast as the Mac OS X client
- ease of use: unmounting, SIGINT, easier logging, easier startup, better
docs, session suspension
For more information and to download, see http://afpfs-ng.sf.net/.
What is new in 0.3, Nov. 27, 2006
---------------------------------
* many, many memory leaks fixed with some help from valgrind and close inspection
* fixed many segfaults from null pointer dereferencing
* heap corruption fixed
* server version matching works now (afpfs-ng speaks 3.2 by default)
* more testing against 10.2, 10.3 and 10.4 and netatalk
* some documentation
* preliminary support for resource forks (although this is still incomplete and broken)
0.2 had a lot of problems with stability, mostly because of the complex and optimized DSI read code, which does zero-copy reads and handles quantums properly. This appears to be fixed now.
Please, if you've tried afpfs-ng, let me know. You can subscribe to the mailing list at http://sourceforge.net/projects/afpfs-ng, or mail me at alexthepuffin@gmail.com.
What is new in 0.2, Nov. 20, 2006
---------------------------------
In version 0.2, the project has matured considerably. You can mount a volume,
see, read and write files with reasonable performance.
* much better testing against 10.3 and 10.4 (speaking AFP 3.1, not 3.2)
* better error handling
* restructured into client/server
* rewrote incoming reads to optimize for read performance. It works!
* lots and lots of other changes
- fixed rename, large dids, UTF8 names
* dynamic quantum calculation
* status
* new logging mechanism, forking
* autoconf (sigh)
What is new in 0.1, Oct. 16, 2006
---------------------------------
* it compiles
* it has worked for me, but probably nobody else

View File

@ -1,4 +1,41 @@
afpfs-ng
========
## Apple Filing Protocol Library - afpfs-ng - libafpclient
### Description
AFPFS is a client implementation of the Apple Filing Protocol written in C which
can be used to access AFP shares exposed by multiple devices, notably Mac OS X
computers, linux devices exporting shares with netatalk, Apple Airport and
Time Capsule products as well as other NAS devices from various vendors.
### Changelog
This is afpfs-ng-0.8.2, it brings IPV6 support and includes many bugfixes.
Read NEWS for more details.
### Installation and usage
See INSTALL, NEWS and docs/README.
### Credits and license
This is a fork of the original afpfs-ng project that has gone unmaintained
for quite some time. It is so far the only available open source AFP client.
This repository includes many patches collected by the XBMC project
(www.xbmc.org) as well as mine, in a bid to improve stability, performance and
to implement new features.
Check AUTHORS for a somewhat complete list of contributors.
The original afpfs-ng webiste can be found at https://sites.google.com/site/alexthepuffin/home
This project retains the original author's license and is distributed under the GPL.
### Feedback and patches
Feel free to send your feedback/patches/flames at simon (dot) vetter (at) gmx.com .
afpfs-ng/libafpclient is an open source client implementation for the Apple Filing Protocol

146
TODO Normal file
View File

@ -0,0 +1,146 @@
Things to be done shortly
==========================
* fix and test [mac]fuse (poorly tested at this point, I have mostly
been using XBMC and afpcmd)
* more testing of the network code, especially in high latency/unstable
network environments
* refactor lib internals
Things to be fixed post-0.5 (aka original FUTURE file)
===========================
Command line:
* remote filename completion
* completion with BSD's readline
* version detection
* OS guessing
FUSE:
* readonly mounts aren't supported
AFP 2.x:
* non-UTF8 server names aren't supported
* signature in status appears to be broken
* use getsrvrinfo to get connection IP address to make room for AT
* connection recovery
- open files
- locked files
General bugs:
* requesting a specific AFP version is unreliable
* filenames have a maximum length of 255, but AFP 3.x allows for much more
* forget username/password after they're used. Can we actually do this?
* Multiple users: have one afpfsd running and multiple uids doing mounts
* Icon support:
- full query/result support
- retrieval tool: a userspace app that can parse icons from resource forks
* Complete implementation of AFP 3.2
- pretty much every function needs testing and correcting
* Proper utf8 support
- need per-volume character encoding
* AFP 2.x support
- desktop database support
- UTF8 flag is now server-specific, but it should be volume-specific
- non-UTF8 codepage translation
- lots, lots more
* More UAMs
- ClientKRB
- reconnection
* Being able to change password
- Open directory integration
* Extended attributes
* Function 75, whatever this is
* Ongoing performance tweaking
- in mknod(), you only need to do the setfiledirparms if the mode or perms
are different
- measurements, comparisons to other clients
- asynchronous unlocking
- use rx and tx quantums properly
- queue writes to be one tx quantum
- optimize locking
- don't go back through the select loop to read what comes after the DSI
packet
- make a preallocated pool of dsi requests
- make a preallocated pool for dsi messages
- is_dir function should look in did cache
- check to see how Mac OS does locking on writes
- large block writes for FUSE 3.x
* Mount by servername
- integration with avahi/bonjour
* use locking primitives in fuse 2.6.1
- mount a subdir
Development:
* When running afpfsd under gdb, unmount doesn't work because of the use of
signals
Protocol bugs:
* afpfs-ng doesn't handle the situation where the server is shutdown
* reconnect isn't reliable
* Do DSI buffers get trampled if there's more than one being handled at the
same time?
* if there is a broken server, the DSI buffers could be overridden
* If a DSI stream gets broken or there's a protocol error, the connection
should be reset
* We don't currently handle reconnect flags or timeouts for DSI attention
packets
* for logins, fpLoginExt should be used instead of fpLogin
* for fpCreateFile, use soft creates
* honour volume's HasConfigInfo flag
Coding
* the apple_translate() function should be truly 'const char * path'
Mounting
* do correct address/signature matching; right now we don't actually use
the signature.
Packaging and polish:
* Make startup scripts (not much point without multi-user support)
Other
- rewrite pick_version to do more intelligent guessing for a version number
- right now, there's a hard coded 1024 in afp_write(). See how the Mac OS
client works.
- after many operations, commands no longer work and neither does ^c
- fix FUSE_USE_VERSION definition
- stop using MAX_PATH, since this is server-specific
- document API
- shutting down notices aren't honoured

0
[config.h].in Normal file
View File

7430
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

BIN
afpfs-ng-0.8.2.tar.gz Normal file

Binary file not shown.

17
cmdline/Makefile.am Normal file
View File

@ -0,0 +1,17 @@
bin_PROGRAMS = afpcmd afpgetstatus
afpgetstatus_SOURCES = getstatus.c
afpgetstatus_LDADD = $(top_builddir)/lib/libafpclient.la
afpgetstatus_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
afpcmd_SOURCES = cmdline_afp.c cmdline_main.c cmdline_testafp.c
afpcmd_LDADD = -lreadline -lncurses $(top_builddir)/lib/libafpclient.la
afpcmd_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
install-data-hook:
mkdir -p $(DESTDIR)/$(mandir)/man1
cp afpcmd.1 $(DESTDIR)$(mandir)/man1
cp afpgetstatus.1 $(DESTDIR)$(mandir)/man1

542
cmdline/Makefile.in Normal file
View File

@ -0,0 +1,542 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = afpcmd$(EXEEXT) afpgetstatus$(EXEEXT)
subdir = cmdline
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_afpcmd_OBJECTS = afpcmd-cmdline_afp.$(OBJEXT) \
afpcmd-cmdline_main.$(OBJEXT) afpcmd-cmdline_testafp.$(OBJEXT)
afpcmd_OBJECTS = $(am_afpcmd_OBJECTS)
afpcmd_DEPENDENCIES = $(top_builddir)/lib/libafpclient.la
afpcmd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(afpcmd_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
am_afpgetstatus_OBJECTS = afpgetstatus-getstatus.$(OBJEXT)
afpgetstatus_OBJECTS = $(am_afpgetstatus_OBJECTS)
afpgetstatus_DEPENDENCIES = $(top_builddir)/lib/libafpclient.la
afpgetstatus_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(afpgetstatus_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(afpcmd_SOURCES) $(afpgetstatus_SOURCES)
DIST_SOURCES = $(afpcmd_SOURCES) $(afpgetstatus_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYCLE_OBJ = @CYCLE_OBJ@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBFUSE_LDFLAGS = @LIBFUSE_LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
afpgetstatus_SOURCES = getstatus.c
afpgetstatus_LDADD = $(top_builddir)/lib/libafpclient.la
afpgetstatus_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
afpcmd_SOURCES = cmdline_afp.c cmdline_main.c cmdline_testafp.c
afpcmd_LDADD = -lreadline -lncurses $(top_builddir)/lib/libafpclient.la
afpcmd_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cmdline/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu cmdline/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
afpcmd$(EXEEXT): $(afpcmd_OBJECTS) $(afpcmd_DEPENDENCIES)
@rm -f afpcmd$(EXEEXT)
$(afpcmd_LINK) $(afpcmd_OBJECTS) $(afpcmd_LDADD) $(LIBS)
afpgetstatus$(EXEEXT): $(afpgetstatus_OBJECTS) $(afpgetstatus_DEPENDENCIES)
@rm -f afpgetstatus$(EXEEXT)
$(afpgetstatus_LINK) $(afpgetstatus_OBJECTS) $(afpgetstatus_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpcmd-cmdline_afp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpcmd-cmdline_main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpcmd-cmdline_testafp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpgetstatus-getstatus.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
afpcmd-cmdline_afp.o: cmdline_afp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -MT afpcmd-cmdline_afp.o -MD -MP -MF $(DEPDIR)/afpcmd-cmdline_afp.Tpo -c -o afpcmd-cmdline_afp.o `test -f 'cmdline_afp.c' || echo '$(srcdir)/'`cmdline_afp.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpcmd-cmdline_afp.Tpo $(DEPDIR)/afpcmd-cmdline_afp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline_afp.c' object='afpcmd-cmdline_afp.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -c -o afpcmd-cmdline_afp.o `test -f 'cmdline_afp.c' || echo '$(srcdir)/'`cmdline_afp.c
afpcmd-cmdline_afp.obj: cmdline_afp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -MT afpcmd-cmdline_afp.obj -MD -MP -MF $(DEPDIR)/afpcmd-cmdline_afp.Tpo -c -o afpcmd-cmdline_afp.obj `if test -f 'cmdline_afp.c'; then $(CYGPATH_W) 'cmdline_afp.c'; else $(CYGPATH_W) '$(srcdir)/cmdline_afp.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpcmd-cmdline_afp.Tpo $(DEPDIR)/afpcmd-cmdline_afp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline_afp.c' object='afpcmd-cmdline_afp.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -c -o afpcmd-cmdline_afp.obj `if test -f 'cmdline_afp.c'; then $(CYGPATH_W) 'cmdline_afp.c'; else $(CYGPATH_W) '$(srcdir)/cmdline_afp.c'; fi`
afpcmd-cmdline_main.o: cmdline_main.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -MT afpcmd-cmdline_main.o -MD -MP -MF $(DEPDIR)/afpcmd-cmdline_main.Tpo -c -o afpcmd-cmdline_main.o `test -f 'cmdline_main.c' || echo '$(srcdir)/'`cmdline_main.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpcmd-cmdline_main.Tpo $(DEPDIR)/afpcmd-cmdline_main.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline_main.c' object='afpcmd-cmdline_main.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -c -o afpcmd-cmdline_main.o `test -f 'cmdline_main.c' || echo '$(srcdir)/'`cmdline_main.c
afpcmd-cmdline_main.obj: cmdline_main.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -MT afpcmd-cmdline_main.obj -MD -MP -MF $(DEPDIR)/afpcmd-cmdline_main.Tpo -c -o afpcmd-cmdline_main.obj `if test -f 'cmdline_main.c'; then $(CYGPATH_W) 'cmdline_main.c'; else $(CYGPATH_W) '$(srcdir)/cmdline_main.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpcmd-cmdline_main.Tpo $(DEPDIR)/afpcmd-cmdline_main.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline_main.c' object='afpcmd-cmdline_main.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -c -o afpcmd-cmdline_main.obj `if test -f 'cmdline_main.c'; then $(CYGPATH_W) 'cmdline_main.c'; else $(CYGPATH_W) '$(srcdir)/cmdline_main.c'; fi`
afpcmd-cmdline_testafp.o: cmdline_testafp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -MT afpcmd-cmdline_testafp.o -MD -MP -MF $(DEPDIR)/afpcmd-cmdline_testafp.Tpo -c -o afpcmd-cmdline_testafp.o `test -f 'cmdline_testafp.c' || echo '$(srcdir)/'`cmdline_testafp.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpcmd-cmdline_testafp.Tpo $(DEPDIR)/afpcmd-cmdline_testafp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline_testafp.c' object='afpcmd-cmdline_testafp.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -c -o afpcmd-cmdline_testafp.o `test -f 'cmdline_testafp.c' || echo '$(srcdir)/'`cmdline_testafp.c
afpcmd-cmdline_testafp.obj: cmdline_testafp.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -MT afpcmd-cmdline_testafp.obj -MD -MP -MF $(DEPDIR)/afpcmd-cmdline_testafp.Tpo -c -o afpcmd-cmdline_testafp.obj `if test -f 'cmdline_testafp.c'; then $(CYGPATH_W) 'cmdline_testafp.c'; else $(CYGPATH_W) '$(srcdir)/cmdline_testafp.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpcmd-cmdline_testafp.Tpo $(DEPDIR)/afpcmd-cmdline_testafp.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cmdline_testafp.c' object='afpcmd-cmdline_testafp.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpcmd_CFLAGS) $(CFLAGS) -c -o afpcmd-cmdline_testafp.obj `if test -f 'cmdline_testafp.c'; then $(CYGPATH_W) 'cmdline_testafp.c'; else $(CYGPATH_W) '$(srcdir)/cmdline_testafp.c'; fi`
afpgetstatus-getstatus.o: getstatus.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpgetstatus_CFLAGS) $(CFLAGS) -MT afpgetstatus-getstatus.o -MD -MP -MF $(DEPDIR)/afpgetstatus-getstatus.Tpo -c -o afpgetstatus-getstatus.o `test -f 'getstatus.c' || echo '$(srcdir)/'`getstatus.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpgetstatus-getstatus.Tpo $(DEPDIR)/afpgetstatus-getstatus.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='getstatus.c' object='afpgetstatus-getstatus.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpgetstatus_CFLAGS) $(CFLAGS) -c -o afpgetstatus-getstatus.o `test -f 'getstatus.c' || echo '$(srcdir)/'`getstatus.c
afpgetstatus-getstatus.obj: getstatus.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpgetstatus_CFLAGS) $(CFLAGS) -MT afpgetstatus-getstatus.obj -MD -MP -MF $(DEPDIR)/afpgetstatus-getstatus.Tpo -c -o afpgetstatus-getstatus.obj `if test -f 'getstatus.c'; then $(CYGPATH_W) 'getstatus.c'; else $(CYGPATH_W) '$(srcdir)/getstatus.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpgetstatus-getstatus.Tpo $(DEPDIR)/afpgetstatus-getstatus.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='getstatus.c' object='afpgetstatus-getstatus.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpgetstatus_CFLAGS) $(CFLAGS) -c -o afpgetstatus-getstatus.obj `if test -f 'getstatus.c'; then $(CYGPATH_W) 'getstatus.c'; else $(CYGPATH_W) '$(srcdir)/getstatus.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-data-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am \
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS
install-data-hook:
mkdir -p $(DESTDIR)/$(mandir)/man1
cp afpcmd.1 $(DESTDIR)$(mandir)/man1
cp afpgetstatus.1 $(DESTDIR)$(mandir)/man1
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

132
cmdline/afpcmd.1 Normal file
View File

@ -0,0 +1,132 @@
.TH afpcmd 1 "13 Nov 2007" 0.5 afpfs-ng
.SH NAME
afpcmd \- Transfer files over the networking using the Apple Filing Protocol (AFP)
.SH SYNOPSIS
\fIafpcmd\fR [\fB-r\f] [\fBafp url\fR]
.SH DESCRIPTION
\fiafpcmd\fR is a command-line tool to help transfer files to and from a server
using AFP. This is typically either Netatalk or Mac OS or Mac OS X.
This can be done as a non-root user. It offers either an interactive command-line
(like a traditional FTP client) or for batch retrievals.
Do not confuse this with the FUSE mounting tools (mount_afp, afpfsd, afp_client),
which offer the ability to mount an entire filesystem.
.SH OPTIONS
\fB-r\fR sets the recursive flag.
\fBafp url\fR uses the standard AFP URL format.
.SH AFP version support
Look at the afpfs-ng documentation for more information on specific AFP version
compatibility information.
.SH Batch mode
Batch file transfers can be done in one of two ways:
\fIafpcmd -r [\fBafp url to directory\fR]
This does a recursive transfer of all subdirectories and files locally.
\fIafpcmd [\fBafp url to file\fR]
This transfers just the file locally.
After either of these is finished, the command exits.
.SH Interactive mode
If a URL is provided on the command line, afpcmd connects and enters the volume and
directory specified.
Standard readline keystrokes are enabled. Command line competion (using tab) and
history (using up and down arrows) is provided. Local filename completion is
enabled.
\fBMost common commands\fR
\fIconnect\fR <afp URL>: Connect to server, change to volume and directory
\fIcd\fR: Change directories on the server
\fIget\fR <filename>: retrieve file
\fIget\fR -r <directory>: Recursively retrieve the directory
\fIput\fR <filename>: Upload file
\fIquit\fR: Quit
\fBConect/disconnect commands\fR
\fIdisconnect\fR: Disconnect from current server
\fIpasswd\fR: Prompts for a new password without showing on screen
\fIuser\fR <user>: Set the user
\fIpasswd\fR: change the password on the server. Does not work.
\fBRemote directory commands\fR
\fIpwd\fR: Show current directory on server
\fImkdir\fR <directory>: create new directory
\fIrmdir\fR <directory: remove directory
\fIls\fR or \fIdir\fR: show files in current directory
\fBRemote file commands\fR
\fImv\fR or \fIrename\fR old_file new_file: Rename <old file> to <new file>
\fItouch\fR <filename>: Create a blank file
\fIview\fR <filename>: Show file
\fIchmod\fR: <file> <mode>: Change the mode of a file on the server
\fIdelete\fR of \fIrm\fR: <file>: Remove file from the server
\fBStatus commands\fR
\fIstatus\fR: Show status of the connection and details. For debugging.
\fIdf\fR: Show the disk size and available blocks.
\fBLocal commands\fR
\fIlpwd\fR: Show current local
\fIlcd\fR: Change local directory
\fBOther commands\fR
\fIhelp\fR or \fI?\fR: show help
\fItestafp\fR: various tests for developers
.SH AFP URLs
A typical usage of afpcmd is:
\fIafpcmd\fR afp://username:password@servername/volume
The complete syntax of a URL is:
afp://username;AUTH=authtype:password@server:port/volume/path
If a password of "-" is provided, the user is prompted for a password.
.SH "REPORTING BUGS"
Report bugs to the afpfs-ng-devel@sf.net mailing list.
.SH "SEE ALSO"
\fBafpgetstatus\fR(1)

27
cmdline/afpgetstatus.1 Normal file
View File

@ -0,0 +1,27 @@
.TH afpcmd 1 "4 Feb 2008" 0.8 afpfs-ng
.SH NAME
afpgetstatus \- Get simple status information from an AFP server without logging into it.
.SH SYNOPSIS
\fIafpgetstatus [afp_url|ipaddress[:port]]\R
.SH DESCRIPTION
\fiafpcmd\fR is a command-line tool that parses and prints the status information of an AFP server. It does this without having to login to a server.
It is a response to the DSI GetStatus request (which is the same as the AFP FPGetSrvrInfo).
It only handles IPv4 addresses.
.SH OPTIONS
\fBafp_url\fR an AFP url in the form of \fIafp://servername:port/\fR. Any other AFP url fields (username, volume name, etc) are ignored.
\fBipaddress\fR the IP address of the server
\fBport\fR the TCP port to connect to (optional)
.SH "REPORTING BUGS"
Report bugs to the afpfs-ng-devel@sf.net mailing list.
.SH "SEE ALSO"
\fBafpcmd\fR(1)

1240
cmdline/cmdline_afp.c Normal file

File diff suppressed because it is too large Load Diff

32
cmdline/cmdline_afp.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef CMDLINE_AFP_H_
#define CMDLINE_AFP_H_
int full_url;
int com_connect(char * arg);
int com_dir(char * arg);
int com_chmod(char * arg);
int com_put(char *filename);
int com_get (char *filename);
int com_view (char * arg);
int com_rename (char * arg);
int com_delete (char *arg);
int com_mkdir(char *arg);
int com_rmdir(char *arg);
int com_lcd(char * path);
int com_cd (char *path);
int com_touch(char *path);
int com_lpwd (char * ignore);
int com_pwd (char * ignore);
int com_passwd (char * ignore);
int com_status(char * arg);
int com_statvfs(char * arg);
int com_pass(char * arg);
int com_user(char * arg);
int com_disconnect(char * arg);
void cmdline_afp_exit(void);
int cmdline_afp_setup(int recursive, char * url_string);
#endif

430
cmdline/cmdline_main.c Normal file
View File

@ -0,0 +1,430 @@
/*
Copyright (C) 1987-2002 Free Software Foundation, Inc.
portions Copyright (C) 2007 Alex deVries
This is based on readline's filemap.c example, which is very useful.
*/
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <getopt.h>
#include <ctype.h>
#include <signal.h>
#include "cmdline_afp.h"
#include "cmdline_testafp.h"
static int running=1;
static int loop_started=0;
static pthread_cond_t connected_condition;
static pthread_cond_t loop_started_condition;
extern int com_testafp(char * arg);
static struct termios save_termios;
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
/* A structure which contains information on the commands this program
* * can understand. */
typedef struct {
char *name; /* User printable name of the function. */
int (*func)(char * arg); /* Function to call to do the job. */
char *doc; /* Documentation for this function. */
int thread; /* whether to launch as a new thread */
} COMMAND;
void trigger_connected(void)
{
pthread_cond_signal(&connected_condition);
}
static int tty_reset(int fd)
{
if (tcsetattr(fd,TCSAFLUSH,&save_termios)<0)
return -1;
return 0;
}
/* Strip whitespace from the start and end of STRING. Return a pointer
into STRING. */
static char * stripwhite (char * string)
{
char *s, *t;
for (s = string; whitespace (*s); s++);
if (*s == 0) return (s);
t = s + strlen (s) - 1;
while (t > s && whitespace (*t))
t--;
*++t = '\0';
return s;
}
/* **************************************************************** */
/* */
/* Interface to Readline Completion */
/* */
/* **************************************************************** */
static char *command_generator (const char *, int);
static int remote_entries_num=0;
static char * remote_generator (const char *text, int state)
{
char * foo = malloc(255);
remote_entries_num++;
sprintf(foo,"Foo");
if (remote_entries_num==5) return NULL;
return foo;
}
/* Attempt to complete on the contents of TEXT. START and END bound the
region of rl_line_buffer that contains the word to complete. TEXT is
the word to complete. We can use the entire contents of rl_line_buffer
in case we want to do some simple parsing. Return the array of matches,
or NULL if there aren't any. */
static char ** filename_completion (const char *text,
int start, int end)
{
char **matches = NULL;
/* If this word is at the start of the line, then it is a command
to complete. Otherwise it is the name of a file in the current
directory. */
#if (RL_VERSION_MAJOR>=5)
if (start == 0)
matches = rl_completion_matches (text, command_generator);
else {
/* This is where we'd do remote filename completion */
}
#endif
return (matches);
}
/* Tell the GNU Readline library how to complete. We want to try to complete
on command names if this is the first word in the line, or on filenames
if not. */
static void initialize_readline ()
{
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name = "afpfsd";
/* Tell the completer that we want a crack first. */
rl_attempted_completion_function = filename_completion;
#if (RL_VERSION_MAJOR>=5)
rl_catch_signals = 1 ;
rl_catch_sigwinch = 1 ;
rl_set_signals () ;
#endif
}
/* The user wishes to quit using this program. Just set DONE non-zero. */
static int com_quit (char *arg)
{
cmdline_afp_exit();
running=0;
return 0;
}
static int com_help (char *arg);
COMMAND commands[] = {
{ "cd", com_cd, "Change to directory DIR",1 },
{ "lcd", com_lcd, "Change local directory to DIR",1 },
{ "chmod", com_chmod, "Change mode",1},
{ "delete", com_delete, "Delete FILE",1 },
{ "mkdir", com_mkdir, "Make directory DIRECTORY",1 },
{ "rmdir", com_rmdir, "Remove directory DIRECTORY",1 },
{ "rm", com_delete, "Delete FILE",1 },
{ "help", com_help, "Display this text",0 },
{ "?", com_help, "Synonym for `help'",0 },
{ "dir", com_dir, "List files in DIR",1 },
{ "testafp", com_testafp, "Special AFP tests",1 },
{ "ls", com_dir, "Synonym for `dir'",1 },
{ "connect", com_connect, "Connect to SERVER",1 },
{ "pwd", com_pwd, "Print the current working directory on the server",0 },
{ "lpwd", com_lpwd, "Print the current local working directory",0 },
{ "quit", com_quit, "Quit",0 },
{ "mv", com_rename, "Rename FILE to NEWNAME",1 },
{ "rename", com_rename, "Rename FILE to NEWNAME",1 },
{ "view", com_view, "View the contents of FILE",1 },
{ "touch", com_touch, "Touch FILE",1 },
{ "get", com_get, "Retrieve the file FILENAME and store them locally",1 },
{ "put", com_put, "Send a file to the server",1 },
{ "passwd", com_passwd, "Change password to PASSWD",1 },
{ "status", com_status, "Get some server status",1 },
{ "df", com_statvfs, "Get volume space information",1 },
{ "pass",com_pass,"Set the password",1},
{ "user",com_user,"Set the user",1},
{ "test",test_urls,"URL parsing test",1},
{ "disconnect",com_disconnect,"Disconnect from the current server",1},
{ (char *)NULL, NULL, (char *)NULL,0 }
};
/* Generator function for command completion. STATE lets us know whether
to start from scratch; without any state (i.e. STATE == 0), then we
start at the top of the list. */
static char * command_generator (const char *text, int state)
{
static int list_index, len;
char *name;
/* If this is a new word to complete, initialize now. This includes
saving the length of TEXT for efficiency, and initializing the index
variable to 0. */
if (!state) {
list_index = 0;
len = strlen (text);
}
/* Return the next name which partially matches from the command list. */
while ((name = commands[list_index].name))
{
list_index++;
if (strncmp (name, text, len) == 0)
{
char *r;
r = malloc (strlen (name) + 1);
strcpy (r, name);
return (r);
}
}
/* If no names matched, then return NULL. */
return ((char *)NULL);
}
/* Print out help for ARG, or for all of the commands if ARG is
not present. */
static int com_help (char *arg)
{
register int i;
int printed = 0;
for (i = 0; commands[i].name; i++)
{
if (!*arg || (strcmp (arg, commands[i].name) == 0))
{
printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
printed++;
}
}
if (!printed)
{
printf ("No commands match `%s'. Possibilties are:\n", arg);
for (i = 0; commands[i].name; i++)
{
/* Print in six columns. */
if (printed == 6)
{
printed = 0;
printf ("\n");
}
printf ("%s\t", commands[i].name);
printed++;
}
if (printed)
printf ("\n");
}
return (0);
}
/* Look up NAME as the name of a command, and return a pointer to that
command. Return a NULL pointer if NAME isn't a command name. */
static COMMAND * find_command (char *name)
{
int i;
for (i = 0; commands[i].name; i++)
if (strcmp (name, commands[i].name) == 0)
return (&commands[i]);
return ((COMMAND *)NULL);
}
/* Execute a command line. */
static int execute_line (char * line)
{
int i;
COMMAND *command;
char *word;
/* Isolate the command word. */
i = 0;
while (line[i] && whitespace (line[i]))
i++;
word = line + i;
while (line[i] && !whitespace (line[i]))
i++;
if (line[i])
line[i++] = '\0';
command = find_command (word);
if (!command) {
fprintf (stderr, "%s: No such command.\n", word);
return (-1);
}
/* Get argument to command, if any. */
while (whitespace (line[i]))
i++;
word = line + i;
/* Call the function. */
command->func(word);
return 0;
}
void * cmdline_ui(void * other)
{
char * line;
#define ARG_LEN 1024
char * s, s2[ARG_LEN];
while (running) {
line = readline ("afpcmd: ");
if (!line) return 0;
/* Remove leading and trailing whitespace from the line.
Then, if there is anything left, add it to the history list
and execute it. */
s = stripwhite (line);
strncpy(s2,s,ARG_LEN);
if (*s) {
add_history (s);
execute_line (s2);
}
free (line);
}
return 0;
}
static void ending(void)
{
if (full_url==0)
printf("Forced exit\n");
cmdline_afp_exit();
tty_reset(STDIN_FILENO);
exit(1);
}
void cmdline_forced_ending_hook(void)
{
ending();
}
void earlyexit_handler(int signum)
{
ending();
}
void cmdline_loop_started(void)
{
loop_started=1;
pthread_cond_signal(&loop_started_condition);
}
static void usage(void)
{
printf(
"afpcmd [-r] [url]\n"
" -r: set the recursive flag\n"
" url: an AFP url, in the form of:\n"
" afp://username;AUTH=authtype:password@server:548/volume/path\n"
"See afpcmd(1) for more information.\n"
);
}
int main(int argc, char *argv[])
{
int option_index=0;
int c, optnum;
int recursive=0;
int show_usage=0;
struct option long_options[] = {
{"recursive",1,0,'r'},
};
char * url = argv[1];
while(1) {
optnum++;
c = getopt_long(argc,argv,"r:h",
long_options,&option_index);
if (c==-1) break;
switch(c) {
case 'h':
show_usage=1;
case 'r':
recursive=1;
url=optarg;
break;
}
}
if (show_usage) {
usage();
exit(1);
}
tcgetattr(STDIN_FILENO,&save_termios);
initialize_readline ();
cmdline_afp_setup_client();
afp_main_quick_startup(NULL);
cmdline_afp_setup(recursive,url);
signal(SIGINT,earlyexit_handler);
cmdline_ui(NULL) ;
tty_reset(STDIN_FILENO);
exit (0);
}

11
cmdline/cmdline_main.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef __CMDLINE_MAIN_H_
#define __CMDLINE_MAIN_H_
void trigger_connected(void);
void cmdline_forced_ending_hook(void);
void cmdline_loop_started(void);
#endif

120
cmdline/cmdline_testafp.c Normal file
View File

@ -0,0 +1,120 @@
/*
Copyright (C) 2008 Alex deVries
*/
#include "afpfs-ng/afp.h"
#include "afpfs-ng/midlevel.h"
#include "cmdline_main.h"
#include <stdlib.h>
#include <stdio.h>
extern struct afp_volume * vol;
static int test_one_url(char * url_string,
e_proto protocol,
char * username,
char * uamname,
char * password,
char * servername,
int port,
char * volumename,
char * path)
{
struct afp_url valid_url;
afp_default_url(&valid_url);
valid_url.protocol=protocol;
sprintf(valid_url.servername, "%s", servername);
sprintf(valid_url.volumename, "%s", volumename);
sprintf(valid_url.path, "%s", path);
sprintf(valid_url.username, "%s", username);
sprintf(valid_url.password, "%s", password);
sprintf(valid_url.uamname,"%s", uamname);
valid_url.port=port;
if (afp_url_validate(url_string,&valid_url))
printf("* Could not parse %s\n",url_string);
else
printf("* Parsed %s correctly\n",url_string);
return 0;
}
int test_urls(char *arg)
{
printf("Testing URL parsing\n");
test_one_url("afp://user::name;AUTH=authtype:pa@@sword@server/volume/path",
TCPIP,"user:name","authtype","pa@sword","server",548,"volume","path");
test_one_url("afp://username;AUTH=authtype:password@server/volume/path",
TCPIP,"username","authtype","password","server",548,"volume","path");
test_one_url("afp://username;AUTH=authtype:password@server:548/volume/path",
TCPIP,"username","authtype","password","server",548,"volume","path");
test_one_url("afp://username:password@server/volume/path",
TCPIP,"username","","password","server",548,"volume","path");
test_one_url("afp://username@server/volume/path",
TCPIP,"username","","","server",548,"volume","path");
test_one_url("afp://server/volume/path",
TCPIP,"","","","server",548,"volume","path");
test_one_url("afp://server/",
TCPIP,"","","","server",548,"","");
test_one_url("afp://server:22/",
TCPIP,"","","","server",22,"","");
test_one_url("afp://server:22",
TCPIP,"","","","server",22,"","");
test_one_url("afp://server:22/volume/",
TCPIP,"","","","server",22,"volume","");
return 0;
}
int com_testafp(char * arg)
{
char * data = malloc(200);
int i;
if (!arg)
arg = "";
for (i=0;i<6;i++) {
data[0]=0x00;
data[1]=0x00;
data[2]=i;
data[3]=4;
data[4]=0x00;
data[5]=0x00;
data[6]=0x00;
data[7]=0x01;
data[8]=0x00;
data[9]=0x00;
data[10]=0x00;
data[11]=0x00;
sprintf(data+12,"%s","mymountpoint");
afp_newcommand76(vol,31,data);
}
return 0;
data[0]=0x00;
data[1]=0x00;
data[2]=0x00;
data[3]=0x04;
data[4]=0x00;
data[5]=0x00;
data[6]=0x00;
data[7]=0x02;
data[8]=0x00;
data[9]=0x00;
data[10]=0x00;
data[11]=0x00;
afp_newcommand76(vol,12,data);
return 0;
}

View File

@ -0,0 +1,4 @@
#ifndef __CMDLINE_TESTAFP_H_
int test_urls(char *);
#endif

110
cmdline/getstatus.c Normal file
View File

@ -0,0 +1,110 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include "afpfs-ng/afp.h"
static int getstatus(char * address_string, unsigned int port)
{
struct afp_server *server;
struct hostent *h;
int ret;
struct addrinfo * address;
int j, firsttime=0;
char signature_string[AFP_SIGNATURE_LEN*2+1];
struct afp_versions * tmpversion;
if ((address = afp_get_address(NULL,address_string, port)) == NULL) return -1;
server=afp_server_init(address);
ret=afp_server_connect(server,1);
if (ret<0) {
perror("Connecting to server");
return -1;
}
printf("Server name: %s\n",server->server_name_printable);
printf("Machine type: %s\n",server->machine_type);
printf("AFP versions: \n");
for (j=0;j<SERVER_MAX_VERSIONS;j++) {
for (tmpversion=afp_versions;tmpversion->av_name;tmpversion++) {
if (tmpversion->av_number==server->versions[j]) {
printf(" %s\n",tmpversion->av_name);
break;
}
}
}
printf("UAMs:\n");
for (j=1;j<0x100;j<<=1) {
if (j & server->supported_uams) {
printf(" %s\n", uam_bitmap_to_string(j));
firsttime=1;
}
};
for (j=0;j<AFP_SIGNATURE_LEN;j++)
sprintf(signature_string+(j*2),"%02x",
(unsigned int) ((char) server->signature[j]));
printf("Signature: %s\n", signature_string);
out:
free(server);
return 0;
}
static void usage(void)
{
printf("getstatus [afp_url|ipaddress[:port]]\n");
}
int main(int argc, char * argv[])
{
unsigned int port = 548;
struct afp_url url;
char * servername = argv[1];
pthread_t loop_thread;
if (argc!=2) {
usage();
return -1;
}
/* Parse the argument */
afp_default_url(&url);
if (afp_parse_url(&url,argv[1],0)!=0) {
char * p;
/* This is not a url */
if ((p=strchr(servername,':'))!=0) {
/* we have a port */
*p='\0';
p++;
if ((port=atoi(p))<=0) {
printf("Could not understand port %s\n",p);
usage();
return -1;
}
}
} else {
servername = url.servername;
port=url.port;
}
libafpclient_register(NULL);
afp_main_quick_startup(NULL);
if (getstatus(servername,port) == 0) {
} else return -1;
}

142
compile Executable file
View File

@ -0,0 +1,142 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2004-10-12.08
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v | --v*)
echo "compile $scriptversion"
exit 0
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

1500
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

200
config.h.in Normal file
View File

@ -0,0 +1,200 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the `bzero' function. */
#undef HAVE_BZERO
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
/* Define to 1 if you have the <fuse.h> header file. */
#undef HAVE_FUSE_H
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <iconv.h> header file. */
#undef HAVE_ICONV_H
/* Define to 1 if you have the `inet_ntoa' function. */
#undef HAVE_INET_NTOA
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `fuse' library (-lfuse). */
#undef HAVE_LIBFUSE
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
#undef HAVE_LIBGCRYPT
/* Define to 1 if you have the `gmp' library (-lgmp). */
#undef HAVE_LIBGMP
/* Define to 1 if you have the `ncurses' library (-lncurses). */
#undef HAVE_LIBNCURSES
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the `readline' library (-lreadline). */
#undef HAVE_LIBREADLINE
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
/* Define to 1 if you have the <syslog.h> header file. */
#undef HAVE_SYSLOG_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 if `fork' works. */
#undef HAVE_WORKING_FORK
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to the type of arg 1 for `select'. */
#undef SELECT_TYPE_ARG1
/* Define to the type of args 2, 3 and 4 for `select'. */
#undef SELECT_TYPE_ARG234
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Version number of package */
#undef VERSION
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define as `fork' if `vfork' does not work. */
#undef vfork

1616
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

23433
configure vendored Executable file

File diff suppressed because it is too large Load Diff

98
configure.ac Normal file
View File

@ -0,0 +1,98 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(afpfs-ng, 0.8.2)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([lib/afp.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lncurses':
AC_CHECK_LIB([ncurses], [main])
AC_CHECK_LIB([readline],[readline])
AC_CHECK_LIB([pthread], [pthread_create])
AC_SUBST([CYCLE_OBJ])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h stddef.h stdlib.h string.h strings.h sys/socket.h sys/time.h syslog.h unistd.h utime.h iconv.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([bzero gethostbyname gettimeofday inet_ntoa memset select socket strchr strerror strstr strtol])
AM_CONDITIONAL(HAVE_LIBGCRYPT, false)
AC_ARG_ENABLE(gcrypt, [ --disable-gcrypt build without gcrypt (limits supported UAMs)])
if test "x$enable_gcrypt" != "xno" ; then
AC_CHECK_LIB([gcrypt], [gcry_cipher_open])
case $host in
*-*-darwin*)
AC_MSG_CHECKING([for correct gcrypt version])
AM_CONDITIONAL(HAVE_LIBGCRYPT, true)
AC_DEFINE([HAVE_LIBGCRYPT], [1] )
;;
*)
;;
esac
fi
AM_CONDITIONAL(HAVE_LIBFUSE, false)
AM_CONDITIONAL(HAVE_FUSE_H, false)
case $host in
*-*-darwin*)
;;
*)
AC_ARG_ENABLE(fuse, [ --disable-fuse build without fuse])
if test "x$enable_fuse" != "xno" ; then
old_cflags=$CFLAGS
old_cppflags=$CPPFLAGS
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26 "
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
AC_CHECK_HEADERS(fuse.h)
if test "x$ac_cv_header_fuse_h" != "xyes" ; then
AC_MSG_ERROR([FUSE is not installed. To build without fuse, configure with '--disable-fuse'])
fi
AC_CHECK_LIB([fuse], [fuse_main])
CFLAGS=$old_cflags
CPPFLAGS=$old_cppflags
LIBFUSE_LDFLAGS="-lfuse"
AC_SUBST(LIBFUSE_LDFLAGS)
AM_CONDITIONAL(HAVE_LIBFUSE, true)
fi
;;
esac
AC_CHECK_LIB([gmp], [__gmpz_init])
AC_CONFIG_FILES([lib/Makefile fuse/Makefile cmdline/Makefile Makefile include/Makefile include/afpfs-ng/Makefile docs/Makefile])
AC_OUTPUT

526
depcomp Executable file
View File

@ -0,0 +1,526 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2004-04-25.13
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit 0
;;
-v | --v*)
echo "depcomp $scriptversion"
exit 0
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
if test -z "$depfile"; then
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
dir=`echo "$object" | sed 's,/.*$,/,'`
if test "$dir" = "$object"; then
dir=
fi
# FIXME: should be _deps on DOS.
depfile="$dir.deps/$base"
fi
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# Dependencies are output in .lo.d with libtool 1.4.
# They are output in .o.d with libtool 1.5.
tmpdepfile1="$dir.libs/$base.lo.d"
tmpdepfile2="$dir.libs/$base.o.d"
tmpdepfile3="$dir.libs/$base.d"
"$@" -Wc,-MD
else
tmpdepfile1="$dir$base.o.d"
tmpdepfile2="$dir$base.d"
tmpdepfile3="$dir$base.d"
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
elif test -f "$tmpdepfile2"; then
tmpdepfile="$tmpdepfile2"
else
tmpdepfile="$tmpdepfile3"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

70
distrib/afpfs-ng.spec Normal file
View File

@ -0,0 +1,70 @@
Summary: Apple Filing Protocol client
Distribution: Fedora 8
Name: afpfs-ng
Version: 0.8.1
Release: 1
URL: http://sourceforge.net/projects/afpfs-ng/
Source0: %{name}-%{version}.tar.bz2
License: GPL
Group: System Environment/Base
BuildRoot: %{_tmppath}/%{name}-root
Packager: Alex deVries <alexthepuffin@gmail.com>
BuildRequires: fuse-devel libgcrypt-devel gmp-devel readline-devel
Requires: libgcrypt gmp readline
%description
afpfs-ng is an Apple Filing Protocol client that will allow Linux and BSD systems to see files exported from a Mac OS system or netatalk with AFP over TCP.
%package devel
Summary: Headers for AFP clients
Group: Development/Libraries
%description devel
afpfs-ng development files for new clients
%prep
%setup -q
%build
automake --add-missing --include-deps --foreign
autoconf
%configure
make
%install
%makeinstall
mkdir -p %{RPM_BUILD_ROOT}/usr/share/man/man1
mkdir -p %{RPM_BUILD_ROOT}/usr/include/afpfs-ng
mkdir -p $RPM_BUILD_ROOT/usr/include/afpfs-ng
cp include/afp.h $RPM_BUILD_ROOT/usr/include/afpfs-ng
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/%{name}-%{version}/
%files
%defattr(-,root,root)
/usr/bin/*
/usr/lib/*
/usr/share/man/*
%doc COPYING AUTHORS ChangeLog docs/README docs/performance docs/FEATURES.txt docs/REPORTING-BUGS.txt
%files devel
/usr/include/afpfs-ng/afp.h
/usr/lib/libafpclient.a
/usr/lib/libafpclient.la
%changelog
* Fri Feb 15 2008 Alex deVries <alexthepuffin@gmail.com>.
- Updated to 0.8
* Sat Mar 31 2007 Alex deVries <alexthepuffin@gmail.com>.
- Updated to 0.4.1
* Sun Feb 11 2007 Alex deVries <alexthepuffin@gmail.com>
- Updated to 0.4
* Tue Nov 28 2006 Houritsuchu <houritsuchu@hotmail.com>
- Initial build.

266
docs/FEATURES.txt Normal file
View File

@ -0,0 +1,266 @@
Some compatibility details for afpfs-ng 0.8, February 18, 2008.
A. Login methods
----------------
The following UAMs are implemented:
- Cleartxt Passwrd
- No User Authent
- Randnum Exchange*
- 2-Way Randnum Exchange*
- DHCAST128*
- DHX2*
However, only those with a (*) will exist if you build with libgmp and
libgcrypt. By default, Mac OS X 10.5 and later only support those with a (*).
It is possible to enable cleartext passwords in those versions, but this is
not a great idea.
The following UAMs have not yet been implemented:
- kerberos, this requires integration with a KDC
- reconnect, it is a bit unclear how this should be done with session keys.
This isn't properly described in the docs. It also isn't really a UAM.
Password changing isn't implemented, although it has been roughed in.
The interface would be in afpcmd.
There is no support for open directory.
'status' will show you what UAMs are compiled in and what is being used.
B. Connect, disconnect
----------------------
There are basic facilities to receive and send session keys, but these are not
used.
Server disconnect and reconnect isn't currently working. Right now, there's a
random token that gets sent, but that's it.
The client doesn't recover if the server goes down partway through a transaction.
C. UID and GID mapping
----------------------
One area of complication is around UID and GID mappings. These may differ
between the client and server. There are two modes that are enabled in
afpfs-ng:
1. Common user directory
This is where both the client and server have
identical UIDs and GIDs. This is the case where you have an NIS server
between them, or some other common directory.
2. Login IDs
This is where all the files appear as the user that logged in. This would
typically be used where the databases are separate, and one user expects to
be able to read/write all the files he sees. This can get confusing, since
any files that aren't his will appear to be owned by him, but writing to
them will result in an EPERM.
3. Named mapping
This is where the name (not uid) of the owner is mapped correctly. This is
not implemented.
4. Mapping from file
This is where a file is read that translates client and server ids. This is
not implemented.
afpfs-ng attempts to detect the mapping type automatically; do 'afp_client
status' (for FUSE monts) or 'status' within afpcmd to see what it guessed.
D. Meta information
-------------------
1. Server icon
A readonly copy of the server icon can be found in /.servericon.
2. Resource forks
Every directory has a hidden directory called .AppleDouble, and if a resource
fork exists, you'll find it there. As an example, the resource fork for
/foo/bar/testfile can be found in /foo/bar/.AppleDouble/testfile.
The permissions of the resource fork are the same as the data fork.
3. Desktop functions
a) Comments
The only desktop function that's actually implemented is comments. For file
/dir/foo, they can be found in /dir/.AppleDouble/file.comment
Permissions for the comment are the same as the data fork.
b) Catalog searching
c) Icon searching
d) APPL
None of these are really suitable as a filesystem. But you could get access
to them if you wrote your own client.
4. Finder info
Finder info for files and directories for /dir/foo can be found in
/dir/.AppleDouble/foo.finderinfo.
E. ACLs and extended attributes
-------------------------------
ACLs and extended attributes have not been implemented.
F. Internationalization
-----------------------
For servers that support it, UTF8 usernames, server names, volume names and files are supported.
Older clients (Mac OS 9) that don't use filenames of type long. Other
charsets for files (MacRomanian, etc) are not supported properly. Servernames
are supported.
G. Networks
-----------
IPv6: There is no support for IPv6.
Appletalk: There is no support for Appletalk
IPv4: Yes, of course.
There's no concept of multiple protocols, eg. doing getstatus with one protocol,
then connecting with another, which is what some Apple clients do.
There's no ability to connect based on a name advertized by Bonjour/Avahi, you
need to use the IP or DNS name.
H. Server-specific information
------------------------------
afpfs-ng detects the server type by parsing the Machine Type field in
getstatus. The command line 'afpgetstatus' will show this without you having
to log in. 'status' will show you this also.
The detection is done in order to deal with some details.
1. Mac OS 8
afpfs-ng has never been used with Mac OS 8, so there's no data. You could do
this with AFP over TCP/IP, but this could be difficult. Email me if you have any info.
2. Mac OS 9
This speaks AFP 2.1, so this presents certain restrictions, such as:
- smaller limits on file and disk sizes (4GB)
- creating files larger than 2GB isn't possible and isn't handled properly
- 'df' will report a max of 4GB.
- no support for Unix privileges; all files are reported as 0600, directories
as 0700.
- for directories, timestamps are reported as the mount times, which is what
the Mac OS X client does.
There is no proper charset conversions for filenames. Patches accepted.
This has been lightly tested.
3. Mac OS X
Various versions have been tested, including 10.2, 10.3, 10.4 and 10.5.x. This has been most
heavily tested. Note the restrictions on UAMs above.
10.5 introduces AFP function 76, but there's no documentation on this. Too
bad.
4. Airport Extreme
The airport extreme with firmware 7.1 and 7.2.1 has been tested, and has two
oddities:
- Unix permissions aren't handled at all
- the device has a software bug which can let an authenticated user freeze the
device. I won't describe the problem in any more detail. Apple has
acknowledged the problem, but hasn't yet released updated firmware.
Note that the Airport can serve up SMB and AFP disks; afpfs-ng only handles
AFP.
5. Time Capsule
The Time Capsule is a network backup device meant to handle Time Machine
backups over AFP. This hasn't been released and my wife won't let me buy one,
so there's been no testing. Donations appreciated.
6. Netatalk
This open source server has a few issues, and afpfs-ng tries to work around
them. The most significant one is around file permissions; there's a bug in
older versions whereby some permissions cannot be set with a chmod (particularly
the execute bit on files).
It becomes a bit difficult to identify if you have the newer or older version
of netatalk since it has been changed in CVS, and occurred after 2.0.3. 2.0.4
hasn't been released yet (almost 3 years later). Some distributions (such as
Fedora 8) ship a broken version.
There's a patch available on the afpfs-ng download site, although grabbing a
later version of netatalk from CVS will work also.
After you attempt to 'chmod +x foo', 'status' will show you if it is broken or
not.
7. LaCie devices
The LaCie device has an ARM processor in it, and speaks netatalk. Part of the
problem with that some login crypto is so slow that older versions of afpfs-ng
timeout before the server can complete the crypto. This should be fixed as of
0.8, but this hasn't been tested properly.
I. FUSE-specific bugs
---------------------
There are no facilities for automounting home directories, which is something
that people ask for frequently. This requires having integration into open
directory.
There are some bugs around race conditions that can make heavy load operations
(eg. compiling a kernel) freeze or stall.
Testing has been done based on FUSE 2.7.0.
J.Other
-------
- length of file is currently fixed at 255; this isn't correct for AFP >3.0
K. References
-------------
Not all references are easy to find. The useful ones are:
- Apple Filing Protocol Programming Guide, Version 3.2, 2005-06-04
- AppleTalk Filing Protocol, Versions 2.1 and version 2.2., Apple Computer Inc, 1999
- Inside Macintosh, Macintosh Toolbox Essentials, 1992
And other software:
- netatalk: Netatalk is the server side, and it implements AFP 3.1 over
Appletalk and TCP/IP. It has a long history and has been heavily tested, but
is creative in some of its implementation.
- afpfs: The original afpfs was last release for Linux kernel 2.2.5 and was
written in kernel space. It was written by Ben Hekster, then taken over by
David Foster. I think it was last maintained in 1999 and only handled AFP 2.x.
Truly, afpfs-ng was intended to take over where they left off, but this is a
complete rewrite in order to fit into FUSE.
- hfsplus: This might not seem related, but the way that hfsplus handles
presenting resource forks to userspace may be relevant to how afpfs-ng does
the same.
- wireshark (aka ethereal): the AFP packet parsing is excellent

5
docs/Makefile.am Normal file
View File

@ -0,0 +1,5 @@
DISTFILES = \
FEATURES.txt \
README \
REPORTING-BUGS.txt

326
docs/Makefile.in Normal file
View File

@ -0,0 +1,326 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = docs
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYCLE_OBJ = @CYCLE_OBJ@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBFUSE_LDFLAGS = @LIBFUSE_LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
DISTFILES = \
FEATURES.txt \
README \
REPORTING-BUGS.txt
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu docs/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

86
docs/README Normal file
View File

@ -0,0 +1,86 @@
This is a quick guide on how to use the two different afp clients
in afpfs-ng.
1. The FUSE client
This will let you mount remote filesystems.
As the user who will be needing to access, the file, run the management daemon
by running:
afpfsd
This should fork off. You should see messages in /var/log/messages. For more
details, run it with the '-d' option to see detailed debug info.
To mount a filesystem:
mount_afp "afp://username:password@servername/volumename" <mountpoint>
After this, you should be able to access files on <mountpoint>.
You can see status by running 'afp_client status'. See afpfsd(1),
mount_afp(1) and afp_client(1) for more info.
To add an AFP mount to fstab so it mounts automatically on boot:
a. create a file called '/etc/fuse.conf' with one line:
user_allow_other
b. make sure that any user doing a mount is a member of the group 'fuse' so it can read and write to /dev/fuse
c. create an entry in /etc/fstab entry in the following format:
afpfs#afp://username:mypass10.211.55.2/alexdevries /tmp/xa20 fuse user=adevries,group=fuse 0 0
Here, username and mypass are the login information on the server 10.211.55.2.
The volume name is alexdevries. /tmp/xa20 is the name of the mountpoint.
The user= field is the local user, group needs to be the same the group owner of /dev/fuse (which is typically fuse).
Yes, you will need to put your password in clear text. There is currently no facility to handle open directory. Patches welcome.
2. Running the command line client
There are two modes:
a) interactive mode
afpcmd is a command line tool like an FTP client.
Just run:
afpcmd "afp://username:password@servername/volumename"
(if you enter no volumename, it shows which ones are available. If you
provide no URL, you can use 'connect'. If you provide a '-' as the
password, you will be prompted for one interactively)
Available commands are:
get <filename>: retrieves the filename
get -r <dirname>: recursively retrieves the directory and its contents
put <filename>: send the file
dir: show directory listings
Others are available too; touch, chmod, chown, del, rename, etc. See
afpcmd(1) for more.
b) batch transfer
This will let you quickly transfer one file or recursively a directory,
and then return you to the command prompt.
Eg.
> afpcmd afp://user:pass@server/alexdevries/linux-2.6.14.tar.bz2
Connected to server Cubalibre using UAM "DHX2"
Connected to volume alexdevries
Getting file /linux-2.6.14.tar.bz2
Transferred 39172170 bytes in 2.862 seconds. (13687 kB/s)
See afpcmd(1) for more information.
c) getting status
You can get status information on servers with 'afpgetstatus <servername>'.
This provides some information without having to log in.
See afpgetstatus(1) for more information.

115
docs/REPORTING-BUGS.txt Normal file
View File

@ -0,0 +1,115 @@
This quick document describes how to gather debugging information for afpfs-ng.
Thank you for contributing to the project by submitting a bug report! This
software's quality is heavily influenced by reported bugs. We will help
you as best we can.
Before we start:
- be aware of sending confidential information over the wire and saving it in
your logs
- more information may be required, but this is a good start
A. Problems with afpcmd
-----------------------
This should be the first thing to try.
1. Start a network dump
You can run the following on Mac OS X, Linux or other systems. You can do this
on either the client, server, or a system that sits in between the client and
server. You'll need root access.
Run:
tcpdump -s0 -w my_network_capture port 548
There are other tools to do this, like wireshare/ethereal. Use those if it is
easier, but save it in a tcpdump format.
Keep this running in a window until after you've shown the bug.
2. Perform your operation
Use afpcmd to connect, authenticate, transfer, etc.
Save the console contents to a file called my_command.txt.
3. Mail a copy of the console and network capture.
Tar up all the relevant files with something like:
tar -czf my_afpfsd_bug.tar.gz \
my_network_capture my_debug_log my_status my_command.txt
Write an email message with a description of the problem. There are two
places to email this:
a) afpfs-ng-devel@lists.sourceforge.net (preferred)
b) alexthepuffin@gmail.com
B. For problems with the FUSE client
------------------------------------
1. Kill off any lingering versions of afpfsd
By default, a process called afpfsd runs in the background, you may have one
lingering.
To do this, start with:
killall afpfsd
If the process still exists (use 'ps aux |grep afpfsd' to check), be
rutheless:
killall -9 afpfsd
2. Rerun afpfsd in debug mode
Run:
afpfsd -d > my_debug_log
This will record lots of logging output to a file. Keep this running in a
window.
3. Start a network dump
(as above)
4. Setup the mount
How you setup the mount is dependent on your environment. Run your
'afp_client mount ...' command and copy it into a file called my_command.txt
5. Grab the status output
Get the status with:
afp_client status > my_status
This will exit quickly.
6. Rerun whatever causes the problem
7. Send off a bug report
Kill the tcpdump and afpfsd processes.
Tar up all the relevant files with something like:
tar -czf my_afpfsd_bug.tar.gz \
my_network_capture my_debug_log my_status my_command.txt
Write an email message with a description of the problem. There are two
places to email this:
a) afpfs-ng-devel@lists.sourceforge.net (preferred)
b) alexthepuffin@gmail.com

2
docs/man/Makefile.am Normal file
View File

@ -0,0 +1,2 @@
SUBDIRS = man1

0
docs/man/Makefile.in Normal file
View File

19
docs/man/man1/Makefile.am Normal file
View File

@ -0,0 +1,19 @@
# Makefile.am for man/man1/
SUFFIXES= .tmpl .
.tmpl:
sed -e s@:SBINDIR:@${sbindir}@ \
-e s@:BINDIR:@${bindir}@ \
-e s@:LIBDIR:@${libdir}@ \
<$< >$@
GENERATED_MANS = afpcmd.1
TEMPLATE_FILES = afpcmd.1.tmpl
NONGENERATED_MANS =
man_MANS = $(GENERATED_MANS) $(NONGENERATED_MANS)
CLEANFILES = $(GENERATED_MANS)
EXTRA_DIST = $(TEMPLATE_FILES) $(NONGENERATED_MANS)

View File

3
docs/man/man1/afp.3 Normal file
View File

@ -0,0 +1,3 @@
- versions
- URL

View File

@ -0,0 +1,55 @@
.TH afpcmd 1 "13 Nov 2007" 0.5 afpfs-ng
.SH NAME
afpcmd \- Transfer files over the networking using the Apple Filing Protocol (AFP)
.SH SYNOPSIS
\fI:BINDIR:/afpcmd\fR [\fBafp url\fR]
.SH DESCRIPTION
\fiafpcmd\fR is a command-line tool to help transfer files to and from a server
using AFP. This is typically either Netatalk or Mac OS or Mac OS X.
.SH OPTIONS
\fBafp url\fR uses the standard AFP URL format. See \fBafp(3)\fB fore more information.
.SH
.SH AFP version support
\fiafpcmd\fi uses afpclient, so look at libafpclient(3) for more information
on support for AFP 2.x and 3.x.
.SH
\fIapple_mv\fR is a perl script to move
SOURCE to DEST or multiple SOURCE(s) to DIRECTORY. It also moves the file
specific metadata (including resource forks) to the .AppleDouble directory
for DEST or DIRECTORY. If the .AppleDouble directory doesn't exist for
DEST or DIRECTORY it will create it.
.SH EXAMPLES
\fI:BINDIR:/afpcmd\fR afp://username:password@servername/volume
connects to servername and volume using username and password.
\fI:BINDIR:/afpcmd\fR afp://username:password@servername/
connects to servername and shows the possible volumes.
\fI:BINDIR:/afpcmd\fR afp://username:password@servername/volume/dir
connects to servername, volume and changes to director dir.
\fI:BINDIR:/afpcmd\fR afp://username:password@servername/volume/dir/file
Connects to the server and volume, and retrieves
- filename completion
- history
.SH "REPORTING BUGS"
Report bugs to the afpfs-ng-devel@sf.net mailing list.
.SH "SEE ALSO"
\fBafp\fR(3)

17
docs/performance Normal file
View File

@ -0,0 +1,17 @@
Untarring linux-2.6.14.tar.bz2:
On 10.5, locally:
real 0m24.447s
user 0m13.647s
sys 0m4.395s
On afpfs-ng, to 10.5 server, over parallels:
at least:
real 4m31.275s
user 0m0.000s
sys 0m0.040s
(got about 1/3rd)

21
fuse/Makefile.am Normal file
View File

@ -0,0 +1,21 @@
bin_PROGRAMS = afpfsd mount_afp
mount_afp_SOURCES = client.c
mount_afp_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
mount_afp_LDADD = $(top_builddir)/lib/libafpclient.la
afpfsd_SOURCES = commands.c daemon.c fuse_int.c fuse_error.c
afpfsd_LDADD = $(top_builddir)/lib/libafpclient.la -lfuse
afpfsd_LDFLAGS = -export-dynamic -lfuse
afpfsd_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
install-data-hook:
mkdir -p $(DESTDIR)/$(mandir)/man1
cp mount_afp.1 $(DESTDIR)/$(mandir)/man1
cp afpfsd.1 $(DESTDIR)/$(mandir)/man1
cp afp_client.1 $(DESTDIR)/$(mandir)/man1
install-exec-hook:
rm -f $(DESTDIR)$(bindir)/afp_client
$(LN_S) mount_afp $(DESTDIR)$(bindir)/afp_client
cp afpfs $(DESTDIR)$(bindir)/afpfs

566
fuse/Makefile.in Normal file
View File

@ -0,0 +1,566 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = afpfsd$(EXEEXT) mount_afp$(EXEEXT)
subdir = fuse
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_afpfsd_OBJECTS = afpfsd-commands.$(OBJEXT) afpfsd-daemon.$(OBJEXT) \
afpfsd-fuse_int.$(OBJEXT) afpfsd-fuse_error.$(OBJEXT)
afpfsd_OBJECTS = $(am_afpfsd_OBJECTS)
afpfsd_DEPENDENCIES = $(top_builddir)/lib/libafpclient.la
afpfsd_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(afpfsd_CFLAGS) $(CFLAGS) \
$(afpfsd_LDFLAGS) $(LDFLAGS) -o $@
am_mount_afp_OBJECTS = mount_afp-client.$(OBJEXT)
mount_afp_OBJECTS = $(am_mount_afp_OBJECTS)
mount_afp_DEPENDENCIES = $(top_builddir)/lib/libafpclient.la
mount_afp_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mount_afp_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(afpfsd_SOURCES) $(mount_afp_SOURCES)
DIST_SOURCES = $(afpfsd_SOURCES) $(mount_afp_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYCLE_OBJ = @CYCLE_OBJ@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBFUSE_LDFLAGS = @LIBFUSE_LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
mount_afp_SOURCES = client.c
mount_afp_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
mount_afp_LDADD = $(top_builddir)/lib/libafpclient.la
afpfsd_SOURCES = commands.c daemon.c fuse_int.c fuse_error.c
afpfsd_LDADD = $(top_builddir)/lib/libafpclient.la -lfuse
afpfsd_LDFLAGS = -export-dynamic -lfuse
afpfsd_CFLAGS = -I$(top_srcdir)/include -D_FILE_OFFSET_BITS=64 @CFLAGS@
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu fuse/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu fuse/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
afpfsd$(EXEEXT): $(afpfsd_OBJECTS) $(afpfsd_DEPENDENCIES)
@rm -f afpfsd$(EXEEXT)
$(afpfsd_LINK) $(afpfsd_OBJECTS) $(afpfsd_LDADD) $(LIBS)
mount_afp$(EXEEXT): $(mount_afp_OBJECTS) $(mount_afp_DEPENDENCIES)
@rm -f mount_afp$(EXEEXT)
$(mount_afp_LINK) $(mount_afp_OBJECTS) $(mount_afp_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpfsd-commands.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpfsd-daemon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpfsd-fuse_error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/afpfsd-fuse_int.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount_afp-client.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
afpfsd-commands.o: commands.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-commands.o -MD -MP -MF $(DEPDIR)/afpfsd-commands.Tpo -c -o afpfsd-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-commands.Tpo $(DEPDIR)/afpfsd-commands.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='commands.c' object='afpfsd-commands.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c
afpfsd-commands.obj: commands.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-commands.obj -MD -MP -MF $(DEPDIR)/afpfsd-commands.Tpo -c -o afpfsd-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-commands.Tpo $(DEPDIR)/afpfsd-commands.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='commands.c' object='afpfsd-commands.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi`
afpfsd-daemon.o: daemon.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-daemon.o -MD -MP -MF $(DEPDIR)/afpfsd-daemon.Tpo -c -o afpfsd-daemon.o `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-daemon.Tpo $(DEPDIR)/afpfsd-daemon.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='daemon.c' object='afpfsd-daemon.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-daemon.o `test -f 'daemon.c' || echo '$(srcdir)/'`daemon.c
afpfsd-daemon.obj: daemon.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-daemon.obj -MD -MP -MF $(DEPDIR)/afpfsd-daemon.Tpo -c -o afpfsd-daemon.obj `if test -f 'daemon.c'; then $(CYGPATH_W) 'daemon.c'; else $(CYGPATH_W) '$(srcdir)/daemon.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-daemon.Tpo $(DEPDIR)/afpfsd-daemon.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='daemon.c' object='afpfsd-daemon.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-daemon.obj `if test -f 'daemon.c'; then $(CYGPATH_W) 'daemon.c'; else $(CYGPATH_W) '$(srcdir)/daemon.c'; fi`
afpfsd-fuse_int.o: fuse_int.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-fuse_int.o -MD -MP -MF $(DEPDIR)/afpfsd-fuse_int.Tpo -c -o afpfsd-fuse_int.o `test -f 'fuse_int.c' || echo '$(srcdir)/'`fuse_int.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-fuse_int.Tpo $(DEPDIR)/afpfsd-fuse_int.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_int.c' object='afpfsd-fuse_int.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-fuse_int.o `test -f 'fuse_int.c' || echo '$(srcdir)/'`fuse_int.c
afpfsd-fuse_int.obj: fuse_int.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-fuse_int.obj -MD -MP -MF $(DEPDIR)/afpfsd-fuse_int.Tpo -c -o afpfsd-fuse_int.obj `if test -f 'fuse_int.c'; then $(CYGPATH_W) 'fuse_int.c'; else $(CYGPATH_W) '$(srcdir)/fuse_int.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-fuse_int.Tpo $(DEPDIR)/afpfsd-fuse_int.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_int.c' object='afpfsd-fuse_int.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-fuse_int.obj `if test -f 'fuse_int.c'; then $(CYGPATH_W) 'fuse_int.c'; else $(CYGPATH_W) '$(srcdir)/fuse_int.c'; fi`
afpfsd-fuse_error.o: fuse_error.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-fuse_error.o -MD -MP -MF $(DEPDIR)/afpfsd-fuse_error.Tpo -c -o afpfsd-fuse_error.o `test -f 'fuse_error.c' || echo '$(srcdir)/'`fuse_error.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-fuse_error.Tpo $(DEPDIR)/afpfsd-fuse_error.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_error.c' object='afpfsd-fuse_error.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-fuse_error.o `test -f 'fuse_error.c' || echo '$(srcdir)/'`fuse_error.c
afpfsd-fuse_error.obj: fuse_error.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -MT afpfsd-fuse_error.obj -MD -MP -MF $(DEPDIR)/afpfsd-fuse_error.Tpo -c -o afpfsd-fuse_error.obj `if test -f 'fuse_error.c'; then $(CYGPATH_W) 'fuse_error.c'; else $(CYGPATH_W) '$(srcdir)/fuse_error.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/afpfsd-fuse_error.Tpo $(DEPDIR)/afpfsd-fuse_error.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_error.c' object='afpfsd-fuse_error.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(afpfsd_CFLAGS) $(CFLAGS) -c -o afpfsd-fuse_error.obj `if test -f 'fuse_error.c'; then $(CYGPATH_W) 'fuse_error.c'; else $(CYGPATH_W) '$(srcdir)/fuse_error.c'; fi`
mount_afp-client.o: client.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mount_afp_CFLAGS) $(CFLAGS) -MT mount_afp-client.o -MD -MP -MF $(DEPDIR)/mount_afp-client.Tpo -c -o mount_afp-client.o `test -f 'client.c' || echo '$(srcdir)/'`client.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mount_afp-client.Tpo $(DEPDIR)/mount_afp-client.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client.c' object='mount_afp-client.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mount_afp_CFLAGS) $(CFLAGS) -c -o mount_afp-client.o `test -f 'client.c' || echo '$(srcdir)/'`client.c
mount_afp-client.obj: client.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mount_afp_CFLAGS) $(CFLAGS) -MT mount_afp-client.obj -MD -MP -MF $(DEPDIR)/mount_afp-client.Tpo -c -o mount_afp-client.obj `if test -f 'client.c'; then $(CYGPATH_W) 'client.c'; else $(CYGPATH_W) '$(srcdir)/client.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/mount_afp-client.Tpo $(DEPDIR)/mount_afp-client.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client.c' object='mount_afp-client.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mount_afp_CFLAGS) $(CFLAGS) -c -o mount_afp-client.obj `if test -f 'client.c'; then $(CYGPATH_W) 'client.c'; else $(CYGPATH_W) '$(srcdir)/client.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-exec-am: install-binPROGRAMS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-data-am install-exec-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am \
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-exec-hook install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS
install-data-hook:
mkdir -p $(DESTDIR)/$(mandir)/man1
cp mount_afp.1 $(DESTDIR)/$(mandir)/man1
cp afpfsd.1 $(DESTDIR)/$(mandir)/man1
cp afp_client.1 $(DESTDIR)/$(mandir)/man1
install-exec-hook:
rm -f $(DESTDIR)$(bindir)/afp_client
$(LN_S) mount_afp $(DESTDIR)$(bindir)/afp_client
cp afpfs $(DESTDIR)$(bindir)/afpfs
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

98
fuse/afp_client.1 Normal file
View File

@ -0,0 +1,98 @@
.TH AFP_CLIENT "3 February 2008" "afpfs-ng"
.SH NAME
afp_client\- Mount, unmount and control Apple Filing Protocol (AFP) sessions using the FUSE infrastructure.
.SH SYNOPSIS
.B "afp_client mount|status|unmount|suspend|resume|exit [options]"
.SH DESCRIPTION
.B afp_client
command allows you to perform some basic functions to access AFP volumes, such as mount, unmount, get status, suspend and resume.
Do not confuse this with afpcmd; afp_client is to be used only for the FUSE client, in conjunction with afpfsd(1). afpcmd is a batch-mode file transferring client. Both of them use the afpfs-ng libraries.
afp_mount(1) is normally a symlink to afp_client. It only handles mounting commands with a fully formed AFP URL.
.SH COMMANDS
.TP
.B mount
The name of the interface. This is usually a driver name followed by
a unit number, for example
.B eth0
for the first Ethernet interface.
.TP
.B mount [mount options] node
Using the authentication and server information provided with the mount options, mount the remove filesystem on node. For more information, see the "mount options" later in this man page. If you would prefer to use the AFP URL syntax, see mount_afp(1) for more information.
.TP
.B unmount node
Remove the AFP mount that is currently connected to
.B node
.TP
.B status
Show status information of all connected servers. This will provide information on connected servers' IP address, server descriptions (machine type, machine name, signature, login message) and available volumes. It also provides statistics and other details.
.Lp
This is crtical for debugging.
.TP
.B suspend
Suspends but does not unmount the current connections to all currently connected server. Currently unsupported.
.TP
.B resume
Resumes all suspended server connections. Currently unsupported.
Enable or disable the
.B promiscuous
mode of the interface. If selected, all packets on the network will
be received by the interface.
.SH MOUNT FLAGS
.TP
.B -u, --user <username>
Log in using <username>
.TP
.B -p, --pass <password>
If you specify a '-' as the password, you will be prompted for it. This allows you to use a password without having to expose it on the command line.
.TP
.B -o, --port <portnum>
Use TCP portnum instead of the default, 548.
.TP
.B -V, --volumepassword <volumepassword>
Use this if the volume you're accessing uses a volume password (a very weak form of protection as it is transferred as clear text). If you specify a '-' as the password, you will be prompted for it. This allows you to use a password without having to expose it on the command line.
If you specify a '-' as the password, you will be prompted for it. This allows you to use a password without having to expose it on the command line.
.TP
.B -v, --version <afp version>
Specify the AFP version that will be used for a mount. For AFP 2.2, use '22', for 3.2, use '32', etc. By default afpfs-ng will choose the highest AFP version shared between the client and server. afpfs-ng supports AFP 2.0 up to 3.2.
.B -a, --uam <uam>
Set the authentication method, to one of:
.RS
.PP
.I No User Authent
.PP
.I Cleartxt Passwrd
.PP
.I Randnum Exchange
.PP
.I 2-Way Randnum Exchange
.PP
.I DHCAST128
.PP
.I Client Krb v2
.PP
.I DHX2
.RE
If you do not specify a UAM, the most secure one common to both the server and client (afpfs-ng) will be chosen.
.TP
.B -m, --map <uam>
Set the method used to map local to server UID and GIDs. Posible values are:
.RS
.PP
.I Common user directory
This should be used in an environment where the UID and GID of the client and server are expected to match perfectly. An example of this is where there is an NIS or open directory server.
.PP
.I Login ids
Use this when you want all files to appear to be owned by the uid and gid of the userid that you used for your authentication information.
.TP
.SH HISTORY
afp_client is part of the FUSE implementation of afpfs-ng.
.SH SEE ALSO
afpfsd(1), mount_afp(1)
.SH AUTHORS
Alex deVries, alexthepuffin@gmail.com

52
fuse/afp_server.h Normal file
View File

@ -0,0 +1,52 @@
#ifndef _AFP_SERVER_H_
#define _AFP_SERVER_H_
#define SERVER_FILENAME "/tmp/afp_server"
#define AFP_SERVER_COMMAND_MOUNT 1
#define AFP_SERVER_COMMAND_STATUS 2
#define AFP_SERVER_COMMAND_UNMOUNT 3
#define AFP_SERVER_COMMAND_SUSPEND 4
#define AFP_SERVER_COMMAND_RESUME 5
#define AFP_SERVER_COMMAND_PING 6
#define AFP_SERVER_COMMAND_EXIT 7
#define AFP_SERVER_RESULT_OKAY 1
#define AFP_SERVER_RESULT_ERROR 2
#define AFP_SERVER_RESULT_TRYING 3
#define AFP_SERVER_RESULT_WARNING 4
struct afp_server_resume_request {
char server_name[AFP_SERVER_NAME_LEN];
};
struct afp_server_suspend_request {
char server_name[AFP_SERVER_NAME_LEN];
};
struct afp_server_unmount_request {
char mountpoint[255];
};
struct afp_server_mount_request {
struct afp_url url;
unsigned int uam_mask;
char mountpoint[255];
unsigned int volume_options;
unsigned int map;
int changeuid;
};
struct afp_server_status_request {
char volumename[AFP_VOLUME_NAME_LEN];
char servername[AFP_VOLUME_NAME_LEN];
};
struct afp_server_response {
char result;
unsigned int len;
};
#endif

3
fuse/afpfs Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
mount_afp $3 $4 $1 $2

22
fuse/afpfsd.1 Normal file
View File

@ -0,0 +1,22 @@
.TH afpfsd 1 "1 Feb 2008" 0.8 afpfs-ng
.SH NAME
afpfsd \- Daemon to manage AFP sessions for the afpfs-ng FUSE client.
.SH SYNOPSIS
\fIafpfsd\fR [\fB-l|logmethod=method\f] [\f-f|--foreground\f] [\f-d|--debug\f]
.SH DESCRIPTION
\fiafpfsd\fR is a daemon that manages AFP sessions. Functions (like mounting, getting status, etc) can be performed using the afp_client(1) tool. This client communicates with the daemon over a named pipe.
afpfsd will not start if another instance is already running. There needs to be one copy of afpfsd running per user.
.SH OPTIONS
\fB-l|--logmethod\fR sets the method used to log; values are stdout or syslog
\fB-f|--foreground\fR doesn't fork the daemon
\fB-f|--debug\fR puts the daemon in the foreground and dumps logs to stdout
.SH "SEE ALSO"
\fBafp_client\fR(1), \fBmount_afp\fR(1)

586
fuse/client.c Normal file
View File

@ -0,0 +1,586 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
#include <sys/un.h>
#include <getopt.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <grp.h>
#include "config.h"
#include <afpfs-ng/afp.h>
#include "afp_server.h"
#include "afpfs-ng/uams_def.h"
#include "afpfs-ng/map_def.h"
#include "afpfs-ng/libafpclient.h"
#define default_uam "Cleartxt Passwrd"
#define MAX_OUTGOING_LENGTH 8192
#define AFPFSD_FILENAME "afpfsd"
#define DEFAULT_MOUNT_FLAGS (VOLUME_EXTRA_FLAGS_SHOW_APPLEDOUBLE|\
VOLUME_EXTRA_FLAGS_NO_LOCKING | VOLUME_EXTRA_FLAGS_IGNORE_UNIXPRIVS)
static char outgoing_buffer[MAX_OUTGOING_LENGTH];
static int outgoing_len=0;
static unsigned int uid, gid=0;
static int changeuid=0;
static int changegid=0;
static char * thisbin;
static int start_afpfsd(void)
{
char *argv[1];
argv[0]=0;
if (fork()==0) {
char filename[PATH_MAX];
if (changegid) {
if (setegid(gid)) {
perror("Changing gid");
return -1;
}
}
if (changeuid) {
if (seteuid(uid)) {
perror("Changing uid");
return -1;
}
}
snprintf(filename,PATH_MAX,AFPFSD_FILENAME);
if (getenv("PATH")==NULL) {
/* If we don't have an PATH set, it is probably
becaue we are being called from mount,
so go search for it */
snprintf(filename, PATH_MAX,
"/usr/local/bin/%s",AFPFSD_FILENAME);
if (access(filename,X_OK)) {
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);
return -1;
}
}
}
if (execvp(filename,argv)) {
if (errno==ENOENT) {
/* Try the path of afp_client */
char newpath[PATH_MAX];
snprintf(newpath,PATH_MAX,"%s/%s",
(char *)basename(thisbin),AFPFSD_FILENAME);
if (execvp(newpath,argv)) {
perror("Starting up afpfsd\n");
return -1;
}
} else {
perror("Starting up afpfsd");
return -1;
}
}
printf("done threading\n");
}
return 0;
}
static int daemon_connect(void)
{
int sock;
struct sockaddr_un servaddr;
char filename[PATH_MAX];
unsigned char trying=2;
if ((sock=socket(AF_UNIX,SOCK_STREAM,0)) < 0) {
perror("Could not create socket\n");
return -1;
}
memset(&servaddr,0,sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
sprintf(filename,"%s-%d",SERVER_FILENAME,uid);
strcpy(servaddr.sun_path,filename);
while(trying) {
if ((connect(sock,(struct sockaddr*) &servaddr,
sizeof(servaddr.sun_family) +
sizeof(servaddr.sun_path))) >=0)
goto done;
printf("The afpfs daemon does not appear to be running for uid %d, let me start it for you\n", uid);
if (start_afpfsd()!=0) {
printf("Error in starting up afpfsd\n");
goto error;
}
if ((connect(sock,(struct sockaddr*) &servaddr,
sizeof(servaddr.sun_family) +
sizeof(servaddr.sun_path))) >=0)
goto done;
sleep(1);
trying--;
}
error:
perror("Trying to startup afpfsd");
return -1;
done:
return sock;
}
static void usage(void)
{
printf(
"afp_client [command] [options]\n"
" mount [mountopts] <server>:<volume> <mountpoint>\n"
" mount options:\n"
" -u, --user <username> : log in as user <username>\n"
" -p, --pass <password> : use <password>\n"
" If password is '-', password will be hidden\n"
" -o, --port <portnum> : connect using <portnum> instead of 548\n"
" -V, --volumepassword <volpass> : use this volume password\n"
" -v, --afpversion <afpversion> set the AFP version, eg. 3.1\n"
" -a, --uam <uam> : use this authentication method, one of:\n"
" \"No User Authent\", \"Cleartxt Passwrd\", \n"
" \"Randnum Exchange\", \"2-Way Randnum Exchange\", \n"
" \"DHCAST128\", \"Client Krb v2\", \"DHX2\" \n\n"
" -m, --map <mapname> : use this uid/gid mapping method, one of:\n"
" \"Common user directory\", \"Login ids\"\n"
" status: get status of the AFP daemon\n\n"
" unmount <mountpoint> : unmount\n\n"
" suspend <servername> : terminates the connection to the server, but\n"
" maintains the mount. For laptop suspend/resume\n"
" resume <servername> : resumes the server connection \n\n"
" exit : unmounts all volumes and exits afpfsd\n"
);
}
static int send_command(int sock, char * msg,int len)
{
return write(sock,msg,len);
}
static int do_exit(int argc,char **argv)
{
outgoing_len=1;
outgoing_buffer[0]=AFP_SERVER_COMMAND_EXIT;
return 0;
}
static int do_status(int argc, char ** argv)
{
int c;
int option_index=0;
struct afp_server_status_request * req;
int optnum;
struct option long_options[] = {
{"volume",1,0,'v'},
{"server",1,0,'s'},
{0,0,0,0},
};
outgoing_len=sizeof(struct afp_server_status_request)+1;
req = (void *) outgoing_buffer+1;
memset(outgoing_buffer,0,outgoing_len);
outgoing_buffer[0]=AFP_SERVER_COMMAND_STATUS;
while(1) {
optnum++;
c = getopt_long(argc,argv,"v:s:",
long_options,&option_index);
if (c==-1) break;
switch(c) {
case 'v':
snprintf(req->volumename,AFP_VOLUME_NAME_LEN,
"%s",optarg);
break;
}
}
return 0;
}
static int do_resume(int argc, char ** argv)
{
struct afp_server_resume_request * req;
outgoing_len=sizeof(struct afp_server_resume_request)+1;
req = (void *) outgoing_buffer+1;
if (argc<3) {
usage();
return -1;
}
memset(req,0,sizeof(*req));
snprintf(req->server_name,AFP_SERVER_NAME_LEN,"%s",argv[2]);
outgoing_buffer[0]=AFP_SERVER_COMMAND_RESUME;
return 0;
}
static int do_suspend(int argc, char ** argv)
{
struct afp_server_suspend_request * req;
outgoing_len=sizeof(struct afp_server_suspend_request)+1;
req = (void *) outgoing_buffer+1;
if (argc<3) {
usage();
return -1;
}
memset(req,0,sizeof(*req));
snprintf(req->server_name,AFP_SERVER_NAME_LEN,"%s",argv[2]);
outgoing_buffer[0]=AFP_SERVER_COMMAND_SUSPEND;
return 0;
}
static int do_unmount(int argc, char ** argv)
{
struct afp_server_unmount_request * req;
outgoing_len=sizeof(struct afp_server_unmount_request)+1;
req = (void *) outgoing_buffer+1;
if (argc<2) {
usage();
return -1;
}
memset(req,0,sizeof(*req));
snprintf(req->mountpoint,255,"%s",argv[2]);
outgoing_buffer[0]=AFP_SERVER_COMMAND_UNMOUNT;
return 0;
}
static int do_mount(int argc, char ** argv)
{
int c;
int option_index=0;
struct afp_server_mount_request * req;
int optnum;
unsigned int uam_mask=default_uams_mask();
struct option long_options[] = {
{"afpversion",1,0,'v'},
{"volumepassword",1,0,'V'},
{"user",1,0,'u'},
{"pass",1,0,'p'},
{"port",1,0,'o'},
{"uam",1,0,'a'},
{"map",1,0,'m'},
{0,0,0,0},
};
if (argc<4) {
usage();
return -1;
}
outgoing_len=sizeof(struct afp_server_mount_request)+1;
req = (void *) outgoing_buffer+1;
memset(outgoing_buffer,0,outgoing_len);
outgoing_buffer[0]=AFP_SERVER_COMMAND_MOUNT;
req->url.port=548;
req->map=AFP_MAPPING_UNKNOWN;
while(1) {
optnum++;
c = getopt_long(argc,argv,"a:u:m:o:p:v:V:",
long_options,&option_index);
if (c==-1) break;
switch(c) {
case 'a':
if (strcmp(optarg,"guest")==0)
uam_mask=UAM_NOUSERAUTHENT;
else
uam_mask=uam_string_to_bitmap(optarg);
break;
case 'm':
req->map=map_string_to_num(optarg);
break;
case 'u':
snprintf(req->url.username,AFP_MAX_USERNAME_LEN,"%s",optarg);
break;
case 'o':
req->url.port=strtol(optarg,NULL,10);
break;
case 'p':
snprintf(req->url.password,AFP_MAX_PASSWORD_LEN,"%s",optarg);
break;
case 'V':
snprintf(req->url.volpassword,9,"%s",optarg);
break;
case 'v':
req->url.requested_version=strtol(optarg,NULL,10);
break;
}
}
if (strcmp(req->url.password, "-") == 0) {
char *p = getpass("AFP Password: ");
if (p)
snprintf(req->url.password,AFP_MAX_PASSWORD_LEN,"%s",p);
}
if (strcmp(req->url.volpassword, "-") == 0) {
char *p = getpass("Password for volume: ");
if (p)
snprintf(req->url.volpassword,9,"%s",p);
}
optnum=optind+1;
if (optnum>=argc) {
printf("No volume or mount point specified\n");
return -1;
}
if (sscanf(argv[optnum++],"%[^':']:%[^':']",
req->url.servername,req->url.volumename)!=2) {
printf("Incorrect server:volume specification\n");
return -1;
}
if (uam_mask==0) {
printf("Unknown UAM\n");
return -1;
}
req->uam_mask=uam_mask;
req->volume_options=DEFAULT_MOUNT_FLAGS;
if (optnum>=argc) {
printf("No mount point specified\n");
return -1;
}
snprintf(req->mountpoint,255,"%s",argv[optnum++]);
return 0;
}
static void mount_afp_usage(void)
{
printf("Usage:\n mount_afp [-o volpass=password] <afp url> <mountpoint>\n");
}
static int handle_mount_afp(int argc, char * argv[])
{
struct afp_server_mount_request * req = (void *) outgoing_buffer+1;
unsigned int uam_mask=default_uams_mask();
char * urlstring, * mountpoint;
char * volpass = NULL;
int readonly=0;
if (argc<2) {
mount_afp_usage();
return -1;
}
if (strncmp(argv[1],"-o",2)==0) {
char * p = argv[2], *q;
char command[256];
struct passwd * passwd;
struct group * group;
do {
memset(command,0,256);
if ((q=strchr(p,',')))
strncpy(command,p,(q-p));
else
strcpy(command,p);
if (strncmp(command,"volpass=",8)==0) {
p+=8;
volpass=p;
} else if (strncmp(command,"user=",5)==0) {
p=command+5;
if ((passwd=getpwnam(p))==NULL) {
printf("Unknown user %s\n",p);
return -1;
}
uid=passwd->pw_uid;
if (geteuid()!=uid)
changeuid=1;
} else if (strncmp(command,"group=",6)==0) {
p=command+6;
if ((group=getgrnam(p))==NULL) {
printf("Unknown group %s\n",p);
return -1;
}
gid=group->gr_gid;
changegid=1;
} else if (strcmp(command,"rw")==0) {
/* Don't do anything */
} else if (strcmp(command,"ro")==0) {
readonly=1;
} else {
printf("Unknown option %s, skipping\n",command);
}
if (q) p=q+1;
else p=NULL;
} while (p);
urlstring=argv[3];
mountpoint=argv[4];
} else {
urlstring=argv[1];
mountpoint=argv[2];
}
outgoing_len=sizeof(struct afp_server_mount_request)+1;
memset(outgoing_buffer,0,outgoing_len);
afp_default_url(&req->url);
req->changeuid=changeuid;
req->volume_options|=DEFAULT_MOUNT_FLAGS;
if (readonly) req->volume_options |= VOLUME_EXTRA_FLAGS_READONLY;
req->uam_mask=uam_mask;
outgoing_buffer[0]=AFP_SERVER_COMMAND_MOUNT;
req->map=AFP_MAPPING_UNKNOWN;
snprintf(req->mountpoint,255,"%s",mountpoint);
if (afp_parse_url(&req->url,urlstring,0) !=0)
{
printf("Could not parse URL\n");
return -1;
}
if (strcmp(req->url.password,"-")==0) {
char *p = getpass("AFP Password: ");
if (p)
snprintf(req->url.password,AFP_MAX_PASSWORD_LEN,"%s",p);
}
if (volpass && (strcmp(volpass,"-")==0)) {
volpass = getpass("Password for volume: ");
}
if (volpass)
snprintf(req->url.volpassword,9,"%s",volpass);
return 0;
}
static int prepare_buffer(int argc, char * argv[])
{
if (argc<2) {
usage();
return -1;
}
if (strncmp(argv[1],"mount",5)==0) {
return do_mount(argc,argv);
} else if (strncmp(argv[1],"resume",6)==0) {
return do_resume(argc,argv);
} else if (strncmp(argv[1],"suspend",7)==0) {
return do_suspend(argc,argv);
} else if (strncmp(argv[1],"status",6)==0) {
return do_status(argc,argv);
} else if (strncmp(argv[1],"unmount",7)==0) {
return do_unmount(argc,argv);
} else if (strncmp(argv[1],"exit",4)==0) {
return do_exit(argc,argv);
} else {
usage();
return -1;
}
return 0;
}
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;
struct afp_server_response * answer = (void *) incoming_buffer;
memset(incoming_buffer,0,MAX_CLIENT_RESPONSE);
FD_ZERO(&rds);
FD_SET(sock,&rds);
while (1) {
tv.tv_sec=30; tv.tv_usec=0;
ords=rds;
ret=select(sock+1,&ords,NULL,NULL,&tv);
if (ret==0) {
printf("No response from server\n");
return -1;
}
if (FD_ISSET(sock,&ords)) {
packetlen=read(sock,incoming_buffer+len,MAX_CLIENT_RESPONSE-len);
if (packetlen==0) {
printf("Dropped connection\n");
goto done;
}
if (len==0) {
expected_len=((struct afp_server_response *) incoming_buffer)->len;
}
len+=packetlen;
if (len==expected_len+sizeof(struct afp_server_response))
goto done;
if (ret<0) goto error;
}
}
done:
memset(toprint,0,MAX_CLIENT_RESPONSE+200);
snprintf(toprint,MAX_CLIENT_RESPONSE+200,"%s",incoming_buffer+sizeof(*answer));
printf("%s", toprint);
return ((struct afp_server_response *) incoming_buffer)->result;
return 0;
error:
return -1;
}
int main(int argc, char *argv[])
{
int sock;
int ret;
struct afp_volume volume;
thisbin=argv[0];
uid=((unsigned int) geteuid());
volume.server=NULL;
if (strstr(argv[0],"mount_afp")) {
if (handle_mount_afp(argc,argv)<0)
return -1;
}
else if (prepare_buffer(argc,argv)<0)
return -1;
if ((sock=daemon_connect()) < 0)
return -1;
send_command(sock,outgoing_buffer,outgoing_len);
ret=read_answer(sock);
return ret;
}

691
fuse/commands.c Normal file
View File

@ -0,0 +1,691 @@
/*
* commands.c
*
* Copyright (C) 2006 Alex deVries
*
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <utime.h>
#include <stdlib.h>
#include <getopt.h>
#include <sys/un.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdarg.h>
#include <getopt.h>
#include <signal.h>
#include "afpfs-ng/afp.h"
#include "afpfs-ng/dsi.h"
#include "afp_server.h"
#include "afpfs-ng/utils.h"
#include "daemon.h"
#include "afpfs-ng/uams_def.h"
#include "afpfs-ng/codepage.h"
#include "afpfs-ng/libafpclient.h"
#include "afpfs-ng/map_def.h"
#include "fuse_int.h"
#include "fuse_error.h"
#include "fuse_internal.h"
#ifdef __linux
#define FUSE_DEVICE "/dev/fuse"
#else
#define FUSE_DEVICE "/dev/fuse0"
#endif
static int fuse_log_method=LOG_METHOD_SYSLOG;
void trigger_exit(void);
static struct fuse_client * client_base = NULL;
struct afp_volume * global_volume;
static int volopen(struct fuse_client * c, struct afp_volume * volume);
static int process_command(struct fuse_client * c);
static struct afp_volume * mount_volume(struct fuse_client * c,
struct afp_server * server, char * volname, char * volpassword) ;
void fuse_set_log_method(int new_method)
{
fuse_log_method=new_method;
}
static int remove_client(struct fuse_client * toremove)
{
struct fuse_client * c, * prev=NULL;
for (c=client_base;c;c=c->next) {
if (c==toremove) {
if (!prev) client_base=NULL;
else prev->next=toremove->next;
free(toremove);
toremove=NULL;
return 0;
}
prev=c;
}
return -1;
}
static int fuse_add_client(int fd)
{
struct fuse_client * c, *newc;
if ((newc=malloc(sizeof(*newc)))==NULL) goto error;
memset(newc,0,sizeof(*newc));
newc->fd=fd;
newc->next=NULL;
if (client_base==NULL) client_base=newc;
else {
for (c=client_base;c->next;c=c->next);
c->next=newc;
}
return 0;
error:
return -1;
}
static int fuse_process_client_fds(fd_set * set, int max_fd)
{
struct fuse_client * c;
for (c=client_base;c;c=c->next) {
if (FD_ISSET(c->fd,set)) {
if (process_command(c)<0) return -1;
return 1;
}
}
return 0;
}
static int fuse_scan_extra_fds(int command_fd, fd_set *set, int * max_fd)
{
struct sockaddr_un new_addr;
socklen_t new_len = sizeof(struct sockaddr_un);
int new_fd;
if (FD_ISSET(command_fd,set)) {
new_fd=accept(command_fd,(struct sockaddr *) &new_addr,&new_len);
if (new_fd>=0) {
fuse_add_client(new_fd);
FD_SET(new_fd,set);
if ((new_fd+1) > *max_fd) *max_fd=new_fd+1;
}
}
switch (fuse_process_client_fds(set,*max_fd)) {
case -1:
{
int i;
FD_CLR(new_fd,set);
for (i=*max_fd;i>=0;i--)
if (FD_ISSET(i,set)) {
*max_fd=i;
break;
}
}
(*max_fd)++;
close(new_fd);
goto out;
case 1:
goto out;
}
/* unknown fd */
sleep(10);
return 0;
out:
return 1;
}
static void fuse_log_for_client(void * priv,
enum loglevels loglevel, int logtype, const char *message) {
int len = 0;
struct fuse_client * c = priv;
if (c) {
len = strlen(c->client_string);
snprintf(c->client_string+len,
MAX_CLIENT_RESPONSE-len,
"%s", message);
} else {
if (fuse_log_method & LOG_METHOD_SYSLOG)
syslog(LOG_INFO, "%s", message);
if (fuse_log_method & LOG_METHOD_STDOUT)
printf("%s",message);
}
}
struct start_fuse_thread_arg {
struct afp_volume * volume;
struct fuse_client * client;
int wait;
int fuse_result;
int fuse_errno;
int changeuid;
};
static void * start_fuse_thread(void * other)
{
int fuseargc=0;
const char *fuseargv[200];
#define mountstring_len (AFP_SERVER_NAME_LEN+1+AFP_VOLUME_NAME_LEN+1)
char mountstring[mountstring_len];
struct start_fuse_thread_arg * arg = other;
struct afp_volume * volume = arg->volume;
struct fuse_client * c = arg->client;
struct afp_server * server = volume->server;
/* Check to see if we have permissions to access the mountpoint */
snprintf(mountstring,mountstring_len,"%s:%s",
server->server_name_printable,
volume->volume_name_printable);
fuseargc=0;
fuseargv[0]=mountstring;
fuseargc++;
fuseargv[1]=volume->mountpoint;
fuseargc++;
if (get_debug_mode()) {
fuseargv[fuseargc]="-d";
fuseargc++;
} else {
fuseargv[fuseargc]="-f";
fuseargc++;
}
if (arg->changeuid) {
fuseargv[fuseargc]="-o";
fuseargc++;
fuseargv[fuseargc]="allow_other";
fuseargc++;
}
/* #ifdef USE_SINGLE_THREAD */
fuseargv[fuseargc]="-s";
fuseargc++;
/*
#endif
*/
global_volume=volume;
arg->fuse_result=
afp_register_fuse(fuseargc, (char **) fuseargv,volume);
arg->fuse_errno=errno;
arg->wait=0;
pthread_cond_signal(&volume->startup_condition_cond);
log_for_client((void *) c,AFPFSD,LOG_WARNING,
"Unmounting volume %s from %s\n",
volume->volume_name_printable,
volume->mountpoint);
return NULL;
}
static int volopen(struct fuse_client * c, struct afp_volume * volume)
{
char mesg[1024];
unsigned int l = 0;
memset(mesg,0,1024);
int rc=afp_connect_volume(volume,volume->server,mesg,&l,1024);
log_for_client((void *) c,AFPFSD,LOG_ERR,mesg);
return rc;
}
static unsigned char process_suspend(struct fuse_client * c)
{
struct afp_server_suspend_request * req =(void *)c->incoming_string+1;
struct afp_server * s;
/* Find the server */
if ((s=find_server_by_name(req->server_name))==NULL) {
log_for_client((void *) c,AFPFSD,LOG_ERR,
"%s is an unknown server\n",req->server_name);
return AFP_SERVER_RESULT_ERROR;
}
if (afp_zzzzz(s))
return AFP_SERVER_RESULT_ERROR;
loop_disconnect(s);
s->connect_state=SERVER_STATE_DISCONNECTED;
log_for_client((void *) c,AFPFSD,LOG_NOTICE,
"Disconnected from %s\n",req->server_name);
return AFP_SERVER_RESULT_OKAY;
}
static int afp_server_reconnect_loud(struct fuse_client * c, struct afp_server * s)
{
char mesg[1024];
unsigned int l = 2040;
int rc;
rc=afp_server_reconnect(s,mesg,&l,l);
if (rc)
log_for_client((void *) c,AFPFSD,LOG_ERR,
"%s",mesg);
return rc;
}
static unsigned char process_resume(struct fuse_client * c)
{
struct afp_server_resume_request * req =(void *) c->incoming_string+1;
struct afp_server * s;
/* Find the server */
if ((s=find_server_by_name(req->server_name))==NULL) {
log_for_client((void *) c,AFPFSD,LOG_ERR,
"%s is an unknown server\n",req->server_name);
return AFP_SERVER_RESULT_ERROR;
}
if (afp_server_reconnect_loud(c,s))
{
log_for_client((void *) c,AFPFSD,LOG_ERR,
"Unable to reconnect to %s\n",req->server_name);
return AFP_SERVER_RESULT_ERROR;
}
log_for_client((void *) c,AFPFSD,LOG_NOTICE,
"Resumed connection to %s\n",req->server_name);
return AFP_SERVER_RESULT_OKAY;
}
static unsigned char process_unmount(struct fuse_client * c)
{
struct afp_server_unmount_request * req;
struct afp_server * s;
struct afp_volume * v;
int j=0;
req=(void *) c->incoming_string+1;
for (s=get_server_base();s;s=s->next) {
for (j=0;j<s->num_volumes;j++) {
v=&s->volumes[j];
if (strcmp(v->mountpoint,req->mountpoint)==0) {
goto found;
}
}
}
goto notfound;
found:
if (v->mounted != AFP_VOLUME_MOUNTED ) {
log_for_client((void *) c,AFPFSD,LOG_NOTICE,
"%s was not mounted\n",v->mountpoint);
return AFP_SERVER_RESULT_ERROR;
}
afp_unmount_volume(v);
return AFP_SERVER_RESULT_OKAY;
notfound:
log_for_client((void *)c,AFPFSD,LOG_WARNING,
"afpfs-ng doesn't have anything mounted on %s.\n",req->mountpoint);
return AFP_SERVER_RESULT_ERROR;
}
static unsigned char process_ping(struct fuse_client * c)
{
log_for_client((void *)c,AFPFSD,LOG_INFO,
"Ping!\n");
return AFP_SERVER_RESULT_OKAY;
}
static unsigned char process_exit(struct fuse_client * c)
{
log_for_client((void *)c,AFPFSD,LOG_INFO,
"Exiting\n");
trigger_exit();
return AFP_SERVER_RESULT_OKAY;
}
static unsigned char process_status(struct fuse_client * c)
{
struct afp_server * s;
char text[40960];
int len=40960;
if ((c->incoming_size + 1)< sizeof(struct afp_server_status_request))
return AFP_SERVER_RESULT_ERROR;
afp_status_header(text,&len);
log_for_client((void *)c,AFPFSD,LOG_INFO,text);
s=get_server_base();
for (s=get_server_base();s;s=s->next) {
afp_status_server(s,text,&len);
log_for_client((void *)c,AFPFSD,LOG_DEBUG,text);
}
return AFP_SERVER_RESULT_OKAY;
}
static int process_mount(struct fuse_client * c)
{
struct afp_server_mount_request * req;
struct afp_server * s=NULL;
struct afp_volume * volume;
struct afp_connection_request conn_req;
int ret;
struct stat lstat;
if ((c->incoming_size-1) < sizeof(struct afp_server_mount_request))
goto error;
req=(void *) c->incoming_string+1;
/* Todo should check the existance and perms of the mount point */
if ((ret=access(req->mountpoint,X_OK))!=0) {
log_for_client((void *)c,AFPFSD,LOG_DEBUG,
"Incorrect permissions on mountpoint %s: %s\n",
req->mountpoint, strerror(errno));
goto error;
}
if (stat(FUSE_DEVICE,&lstat)) {
printf("Could not find %s\n",FUSE_DEVICE);
goto error;
}
if (access(FUSE_DEVICE,R_OK | W_OK )!=0) {
log_for_client((void *)c, AFPFSD,LOG_NOTICE,
"Incorrect permissions on %s, mode of device"
" is %o, uid/gid is %d/%d. But your effective "
"uid/gid is %d/%d\n",
FUSE_DEVICE,lstat.st_mode, lstat.st_uid,
lstat.st_gid,
geteuid(),getegid());
goto error;
}
log_for_client((void *)c,AFPFSD,LOG_NOTICE,
"Mounting %s from %s on %s\n",
(char *) req->url.servername,
(char *) req->url.volumename,req->mountpoint);
memset(&conn_req,0,sizeof(conn_req));
conn_req.url=req->url;
conn_req.uam_mask=req->uam_mask;
if ((s=afp_server_full_connect(c,&conn_req))==NULL) {
signal_main_thread();
goto error;
}
if ((volume=mount_volume(c,s,req->url.volumename,
req->url.volpassword))==NULL) {
goto error;
}
volume->extra_flags|=req->volume_options;
volume->mapping=req->map;
afp_detect_mapping(volume);
snprintf(volume->mountpoint,255, "%s", req->mountpoint);
/* Create the new thread and block until we get an answer back */
{
pthread_mutex_t mutex;
struct timespec ts;
struct timeval tv;
int ret;
struct start_fuse_thread_arg arg;
memset(&arg,0,sizeof(arg));
arg.client = c;
arg.volume = volume;
arg.wait = 1;
arg.changeuid=req->changeuid;
gettimeofday(&tv,NULL);
ts.tv_sec=tv.tv_sec;
ts.tv_sec+=5;
ts.tv_nsec=tv.tv_usec*1000;
pthread_mutex_init(&mutex,NULL);
pthread_cond_init(&volume->startup_condition_cond,NULL);
/* Kickoff a thread to see how quickly it exits. If
* it exits quickly, we have an error and it failed. */
pthread_create(&volume->thread,NULL,start_fuse_thread,&arg);
if (arg.wait) ret = pthread_cond_timedwait(
&volume->startup_condition_cond,&mutex,&ts);
report_fuse_errors(c);
switch (arg.fuse_result) {
case 0:
if (volume->mounted==AFP_VOLUME_UNMOUNTED) {
/* Try and discover why */
switch(arg.fuse_errno) {
case ENOENT:
log_for_client((void *)c,AFPFSD,LOG_ERR,
"Permission denied, maybe a problem with the fuse device or mountpoint?\n");
break;
default:
log_for_client((void *)c,AFPFSD,LOG_ERR,
"Mounting of volume %s of server %s failed.\n",
volume->volume_name_printable,
volume->server->server_name_printable);
}
goto error;
} else {
log_for_client((void *)c,AFPFSD,LOG_NOTICE,
"Mounting of volume %s of server %s succeeded.\n",
volume->volume_name_printable,
volume->server->server_name_printable);
return 0;
}
break;
case ETIMEDOUT:
log_for_client((void *)c,AFPFSD,LOG_NOTICE,
"Still trying.\n");
return 0;
break;
default:
volume->mounted=AFP_VOLUME_UNMOUNTED;
log_for_client((void *)c,AFPFSD,LOG_NOTICE,
"Unknown error %d, %d.\n",
arg.fuse_result,arg.fuse_errno);
goto error;
}
}
return AFP_SERVER_RESULT_OKAY;
error:
if ((s) && (!something_is_mounted(s))) {
afp_server_remove(s);
}
signal_main_thread();
return AFP_SERVER_RESULT_ERROR;
}
static void * process_command_thread(void * other)
{
struct fuse_client * c = other;
int ret=0;
char tosend[sizeof(struct afp_server_response) + MAX_CLIENT_RESPONSE];
struct afp_server_response response;
switch(c->incoming_string[0]) {
case AFP_SERVER_COMMAND_MOUNT:
ret=process_mount(c);
break;
case AFP_SERVER_COMMAND_STATUS:
ret=process_status(c);
break;
case AFP_SERVER_COMMAND_UNMOUNT:
ret=process_unmount(c);
break;
case AFP_SERVER_COMMAND_SUSPEND:
ret=process_suspend(c);
break;
case AFP_SERVER_COMMAND_RESUME:
ret=process_resume(c);
break;
case AFP_SERVER_COMMAND_PING:
ret=process_ping(c);
break;
case AFP_SERVER_COMMAND_EXIT:
ret=process_exit(c);
break;
default:
log_for_client((void *)c,AFPFSD,LOG_ERR,"Unknown command\n");
}
/* Send response */
response.result=ret;
response.len=strlen(c->client_string);
bcopy(&response,tosend,sizeof(response));
bcopy(c->client_string,tosend+sizeof(response),response.len);
ret=write(c->fd,tosend,sizeof(response)+response.len);
if (ret<0) {
perror("Writing");
}
if ((!c) || (c->fd==0)) return NULL;
rm_fd_and_signal(c->fd);
close(c->fd);
remove_client(c);
return NULL;
}
static int process_command(struct fuse_client * c)
{
int ret;
int fd;
ret=read(c->fd,&c->incoming_string,AFP_CLIENT_INCOMING_BUF);
if (ret<=0) {
perror("reading");
goto out;
}
c->incoming_size=ret;
pthread_t thread;
pthread_create(&thread,NULL,process_command_thread,c);
return 0;
out:
fd=c->fd;
c->fd=0;
remove_client(c);
close(fd);
rm_fd_and_signal(fd);
return 0;
}
static struct afp_volume * mount_volume(struct fuse_client * c,
struct afp_server * server, char * volname, char * volpassword)
{
struct afp_volume * using_volume;
using_volume = find_volume_by_name(server,volname);
if (!using_volume) {
log_for_client((void *) c,AFPFSD,LOG_ERR,
"Volume %s does not exist on server %s.\n",volname,
server->server_name_printable);
if (server->num_volumes) {
char names[1024];
afp_list_volnames(server,names,1024);
log_for_client((void *)c,AFPFSD,LOG_ERR,
"Choose from: %s\n",names);
}
goto error;
}
if (using_volume->mounted==AFP_VOLUME_MOUNTED) {
log_for_client((void *)c,AFPFSD,LOG_ERR,
"Volume %s is already mounted on %s\n",volname,
using_volume->mountpoint);
goto error;
}
if (using_volume->flags & HasPassword) {
bcopy(volpassword,using_volume->volpassword,AFP_VOLPASS_LEN);
if (strlen(volpassword)<1) {
log_for_client((void *) c,AFPFSD,LOG_ERR,"Volume password needed\n");
goto error;
}
} else memset(using_volume->volpassword,0,AFP_VOLPASS_LEN);
if (volopen(c,using_volume)) {
log_for_client((void *) c,AFPFSD,LOG_ERR,"Could not mount volume %s\n",volname);
goto error;
}
using_volume->server=server;
return using_volume;
error:
return NULL;
}
static struct libafpclient client = {
.unmount_volume = fuse_unmount_volume,
.log_for_client = fuse_log_for_client,
.forced_ending_hook =fuse_forced_ending_hook,
.scan_extra_fds = fuse_scan_extra_fds};
int fuse_register_afpclient(void)
{
libafpclient_register(&client);
return 0;
}

7
fuse/commands.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef __COMMANDS_H_
#define __COMMANDS_H_
int fuse_register_afpclient(void);
void fuse_set_log_method(int new_method);
#endif

293
fuse/daemon.c Normal file
View File

@ -0,0 +1,293 @@
/*
* daemon.c
*
* Copyright (C) 2006 Alex deVries
*
*/
#include <sys/types.h>
#include <sys/param.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <utime.h>
#include <stdlib.h>
#include <getopt.h>
#include <sys/un.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdarg.h>
#include <getopt.h>
#include <signal.h>
#include <sys/socket.h>
#include "afpfs-ng/afp.h"
#include "afpfs-ng/dsi.h"
#include "afp_server.h"
#include "afpfs-ng/utils.h"
#include "daemon.h"
#include "commands.h"
#define MAX_ERROR_LEN 1024
#define STATUS_LEN 1024
#define MAX_CLIENT_RESPONSE 2048
static int debug_mode = 0;
static char commandfilename[PATH_MAX];
int get_debug_mode(void)
{
return debug_mode;
}
void fuse_forced_ending_hook(void)
{
struct afp_server * s = get_server_base();
struct afp_volume * volume;
int i;
for (s=get_server_base();s;s=s->next) {
if (s->connect_state==SERVER_STATE_CONNECTED)
for (i=0;i<s->num_volumes;i++) {
volume=&s->volumes[i];
if (volume->mounted==AFP_VOLUME_MOUNTED)
log_for_client(NULL,AFPFSD,LOG_NOTICE,
"Unmounting %s\n",volume->mountpoint);
afp_unmount_volume(volume);
}
}
}
int fuse_unmount_volume(struct afp_volume * volume)
{
if (volume->priv) {
fuse_exit((struct fuse *)volume->priv);
pthread_kill(volume->thread, SIGHUP);
pthread_join(volume->thread,NULL);
}
return 0;
}
static int startup_listener(void)
{
int command_fd;
struct sockaddr_un sa;
int len;
if ((command_fd=socket(AF_UNIX,SOCK_STREAM,0)) < 0) {
goto error;
}
memset(&sa,0,sizeof(sa));
sa.sun_family = AF_UNIX;
strcpy(sa.sun_path,commandfilename);
len = sizeof(sa.sun_family) + strlen(sa.sun_path)+1;
if (bind(command_fd,(struct sockaddr *)&sa,len) < 0) {
perror("binding");
close(command_fd);
goto error;
}
listen(command_fd,5); /* Just one at a time */
return command_fd;
error:
return -1;
}
void close_commands(int command_fd)
{
close(command_fd);
unlink(commandfilename);
}
static void usage(void)
{
printf("Usage: afpfsd [OPTION]\n"
" -l, --logmethod Either 'syslog' or 'stdout'"
" -f, --foreground Do not fork\n"
" -d, --debug Does not fork, logs to stdout\n"
"Version %s\n", AFPFS_VERSION);
}
static int remove_other_daemon(void)
{
int sock;
struct sockaddr_un servaddr;
int len=0, ret;
char incoming_buffer[MAX_CLIENT_RESPONSE];
struct timeval tv;
fd_set rds;
#define OUTGOING_PACKET_LEN 1
char outgoing_buffer[OUTGOING_PACKET_LEN];
if (access(commandfilename,F_OK)!=0)
goto doesnotexist; /* file doesn't even exist */
if ((sock=socket(AF_UNIX,SOCK_STREAM,0))<0) {
perror("Opening socket");
goto error;
}
memset(&servaddr,0,sizeof(servaddr));
servaddr.sun_family = AF_UNIX;
strcpy(servaddr.sun_path,commandfilename);
if ((connect(sock,(struct sockaddr*) &servaddr,
sizeof(servaddr.sun_family) +
sizeof(servaddr.sun_path))) <0) {
goto dead;
}
/* Try writing to it */
outgoing_buffer[0]=AFP_SERVER_COMMAND_PING;
if (write(sock, outgoing_buffer,OUTGOING_PACKET_LEN)
<OUTGOING_PACKET_LEN)
goto dead;
/* See if we get a response */
memset(incoming_buffer,0,MAX_CLIENT_RESPONSE);
FD_ZERO(&rds);
FD_SET(sock,&rds);
tv.tv_sec=10; tv.tv_usec=0;
ret=select(sock+1,&rds,NULL,NULL,&tv);
if (ret==0) {
goto dead; /* Timeout */
}
if (ret<0) {
goto error; /* some sort of select error */
}
/* Let's see if we got a sane message back */
len=read(sock,incoming_buffer,MAX_CLIENT_RESPONSE);
if (len<1)
goto dead;
/* Okay, the server is live */
close(sock);
return -1;
dead:
close(sock);
/* See if we can remove it */
if (access(commandfilename,F_OK)==0) {
if (unlink(commandfilename)!=0) {
log_for_client(NULL, AFPFSD,LOG_NOTICE,
"Cannot remove command file");
return -1;
}
}
return 0;
doesnotexist:
return 0;
error:
close(sock);
return -1;
}
int main(int argc, char *argv[]) {
int option_index=0;
struct option long_options[] = {
{"logmethod",1,0,'l'},
{"foreground",0,0,'f'},
{"debug",1,0,'d'},
{0,0,0,0},
};
int new_log_method=LOG_METHOD_SYSLOG;
int dofork=1;
/* getopt_long()'s return is int; specifying the variable to contain
* this return value as char depends on endian-specific behavior,
* breaking utterly on big endian (i.e., PowerPC)
*/
int c;
int optnum;
int command_fd=-1;
fuse_register_afpclient();
if (init_uams()<0) return -1;
while (1) {
optnum++;
c = getopt_long(argc,argv,"l:fdh",
long_options,&option_index);
if (c==-1) break;
switch (c) {
case 'l':
if (strncmp(optarg,"stdout",6)==0)
fuse_set_log_method(LOG_METHOD_STDOUT);
else if (strncmp(optarg,"syslog",6)==0)
fuse_set_log_method(LOG_METHOD_SYSLOG);
else {
printf("Unknown log method %s\n",optarg);
usage();
}
break;
case 'f':
dofork=0;
break;
case 'd':
dofork=0;
debug_mode=1;
new_log_method=LOG_METHOD_STDOUT;
break;
case 'h':
default:
usage();
return -1;
}
}
fuse_set_log_method(new_log_method);
sprintf(commandfilename,"%s-%d",SERVER_FILENAME,(unsigned int) geteuid());
if (remove_other_daemon()<0) {
log_for_client(NULL, AFPFSD,LOG_NOTICE,
"Daemon is already running and alive\n");
return -1;
}
if ((!dofork) || (fork()==0)) {
if ((command_fd=startup_listener())<0)
goto error;
log_for_client(NULL, AFPFSD,LOG_NOTICE,
"Starting up AFPFS version %s\n",AFPFS_VERSION);
afp_main_loop(command_fd);
close_commands(command_fd);
}
return 0;
error:
printf("Could not start afpfsd\n");
return -1;
}

17
fuse/daemon.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef __DAEMON_H_
#define __DAEMON_H_
void rm_fd_and_signal(int fd);
void signal_main_thread(void);
int get_debug_mode(void);
int add_client(int fd);
int process_client_fds(fd_set * set, int max_fd, int ** onfd);
int fuse_unmount_volume(struct afp_volume * volume);
void fuse_forced_ending_hook(void);
#endif

46
fuse/fuse_error.c Normal file
View File

@ -0,0 +1,46 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include "afpfs-ng/libafpclient.h"
#include "fuse_internal.h"
#define TMP_FILE "/tmp/fuse_stderr"
static int captured_fd;
static fpos_t pos;
void report_fuse_errors(struct fuse_client * c)
{
char buf[1024];
int fd;
int len;
fflush(stderr);
dup2(captured_fd, fileno(stderr));
close(captured_fd);
clearerr(stderr);
fsetpos(stderr, &pos); /* for C9X */
if ((fd=open(TMP_FILE,O_RDONLY))<0) return;;
memset(buf,0,1024);
len=read(fd,buf,1024);
close(fd);
unlink(TMP_FILE);
if (len>0)
log_for_client((void *)c,AFPFSD,LOG_ERR,
"FUSE reported the following error:\n%s",buf);
}
void fuse_capture_stderr_start(void)
{
fflush(stderr);
fgetpos(stderr, &pos);
captured_fd = dup(fileno(stderr));
freopen(TMP_FILE, "a", stderr);
}

10
fuse/fuse_error.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef __FUSE_ERROR_H_
#define __FUSE_ERROR_H_
#include "fuse_internal.h"
void report_fuse_errors(struct fuse_client * c);
void fuse_capture_stderr_start(void);
#endif

511
fuse/fuse_int.c Normal file
View File

@ -0,0 +1,511 @@
/*
fuse.c, FUSE interfaces for afpfs-ng
Copyright (C) 2006 Alex deVries <alexthepuffin@gmail.com>
Heavily modifed from the example code provided by:
Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#define HAVE_ARCH_STRUCT_FLOCK
#define FUSE_USE_VERSION 25
#include "afpfs-ng/afp.h"
#include <fuse.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#ifdef __linux__
#include <asm/fcntl.h>
#else
#include <fcntl.h>
#endif
#include <utime.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <signal.h>
#include <sys/types.h>
#include <pwd.h>
#include <stdarg.h>
#include "afpfs-ng/dsi.h"
#include "afpfs-ng/afp_protocol.h"
#include "afpfs-ng/codepage.h"
#include "afpfs-ng/midlevel.h"
#include "fuse_error.h"
/* Uncomment the following line to enable full debugging: */
/*
#define LOG_FUSE_EVENTS
*/
void log_fuse_event(enum loglevels loglevel, int logtype,
char *format, ...) {
#ifdef LOG_FUSE_EVENTS
va_list ap;
va_start(ap,format);
vprintf(format,ap);
va_end(ap);
#endif
}
static int fuse_readlink(const char * path, char *buf, size_t size)
{
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** readlink of %s\n",path);
ret=ml_readlink(volume,path,buf,size);
if (ret==-EFAULT) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Got some sort of internal error in afp_open for readlink\n");
}
return ret;
}
static int fuse_rmdir(const char *path)
{
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** rmdir of %s\n",path);
ret=ml_rmdir(volume,path);
return ret;
}
static int fuse_unlink(const char *path)
{
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** unlink of %s\n",path);
ret=ml_unlink(volume,path);
return ret;
}
static int fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
{
(void) offset;
(void) fi;
struct afp_file_info * filebase = NULL, * p;
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** readdir of %s\n",path);
filler(buf, ".", NULL, 0);
filler(buf, "..", NULL, 0);
ret=ml_readdir(volume,path,&filebase);
if (ret) goto error;
for (p=filebase;p;p=p->next) {
filler(buf,p->name,NULL,0);
}
afp_ml_filebase_free(&filebase);
return 0;
error:
return ret;
}
static int fuse_mknod(const char *path, mode_t mode, dev_t dev)
{
int ret=0;
struct fuse_context * context = fuse_get_context();
struct afp_volume * volume=
(struct afp_volume *) context->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** mknod of %s\n",path);
ret=ml_creat(volume,path,mode);
return ret;
}
static int fuse_release(const char * path, struct fuse_file_info * fi)
{
struct afp_file_info * fp = (void *) fi->fh;
int ret=0;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** release of %s\n",path);
ret=ml_close(volume,path,fp);
if (ret<0) goto error;
return ret;
error:
free((void *) fi->fh);
return ret;
}
static int fuse_open(const char *path, struct fuse_file_info *fi)
{
struct afp_file_info * fp ;
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
unsigned char flags = AFP_OPENFORK_ALLOWREAD;
log_fuse_event(AFPFSD,LOG_DEBUG,
"*** Opening path %s\n",path);
ret = ml_open(volume,path,flags,&fp);
if (ret==0)
fi->fh=(unsigned long) fp;
return ret;
}
static int fuse_write(const char * path, const char *data,
size_t size, off_t offset,
struct fuse_file_info *fi)
{
struct afp_file_info *fp = (struct afp_file_info *) fi->fh;
int ret;
struct fuse_context * context = fuse_get_context();
struct afp_volume * volume=(void *) context->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,
"*** write of from %llu for %llu\n",
(unsigned long long) offset,(unsigned long long) size);
ret=ml_write(volume,path,data,size,offset,fp,
context->uid, context->gid);
return ret;
}
static int fuse_mkdir(const char * path, mode_t mode)
{
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** mkdir of %s\n",path);
ret=ml_mkdir(volume,path,mode);
return ret;
}
static int fuse_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
struct afp_file_info * fp;
int ret=0;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
int eof;
size_t amount_read=0;
if (!fi || !fi->fh)
return -EBADF;
fp=(void *) fi->fh;
while (1) {
ret = ml_read(volume,path,buf+amount_read,size,offset,fp,&eof);
if (ret<0) goto error;
amount_read+=ret;
if (eof) goto out;
size-=ret;
if (size==0) goto out;
offset+=ret;
}
out:
return amount_read;
error:
return ret;
}
static int fuse_chown(const char * path, uid_t uid, gid_t gid)
{
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,"** chown\n");
ret=ml_chown(volume,path,uid,gid);
if (ret==-ENOSYS) {
log_for_client(NULL,AFPFSD,LOG_WARNING,"chown unsupported\n");
}
return ret;
}
static int fuse_truncate(const char * path, off_t offset)
{
int ret=0;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,
"** truncate\n");
ret=ml_truncate(volume,path,offset);
return ret;
}
static int fuse_chmod(const char * path, mode_t mode)
{
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
int ret;
log_fuse_event(AFPFSD,LOG_DEBUG,
"** chmod %s\n",path);
ret=ml_chmod(volume,path,mode);
switch (ret) {
case -EPERM:
log_for_client(NULL,AFPFSD,LOG_DEBUG,
"You're not the owner of this file.\n");
break;
case -ENOSYS:
log_for_client(NULL,AFPFSD,LOG_WARNING,"chmod unsupported or this mode is not possible with this server\n");
break;
case -EFAULT:
log_for_client(NULL,AFPFSD,LOG_ERR,
"You're mounting from a netatalk server, and I was trying to change "
"permissions but you're setting some mode bits that aren't supported "
"by the server. This is because this netatalk server is broken. \n"
"This is because :\n"
" - you haven't set -options=unix_priv in AppleVolumes.default\n"
" - you haven't applied a patch which fixes chmod() to netatalk, or are using an \n"
" old version. See afpfs-ng docs.\n"
" - maybe both\n"
"It sucks, but I'm marking this volume as broken for 'extended' chmod modes.\n"
"Allowed bits are: %o\n", AFP_CHMOD_ALLOWED_BITS_22);
ret=0; /* Return anyway */
break;
}
return ret;
}
static int fuse_utime(const char * path, struct utimbuf * timebuf)
{
int ret=0;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
log_fuse_event(AFPFSD,LOG_DEBUG,
"** utime\n");
ret=ml_utime(volume,path,timebuf);
return ret;
}
static void afp_destroy(void * ignore)
{
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
if (volume->mounted==AFP_VOLUME_UNMOUNTED) {
log_for_client(NULL,AFPFSD,LOG_WARNING,"Skipping unmounting of the volume %s\n",volume->volume_name_printable);
return;
}
if ((!volume) || (!volume->server)) return;
/* We're just ignoring the results since there's nothing we could
do with them anyway. */
afp_unmount_volume(volume);
}
static int fuse_symlink(const char * path1, const char * path2)
{
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
int ret;
ret=ml_symlink(volume,path1,path2);
if ((ret==-EFAULT) || (ret==-ENOSYS)) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Got some sort of internal error in when creating symlink\n");
}
return ret;
};
static int fuse_rename(const char * path_from, const char * path_to)
{
int ret;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
ret=ml_rename(volume,path_from, path_to);
return ret;
}
static int fuse_statfs(const char *path, struct statvfs *stat)
{
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
int ret;
ret=ml_statfs(volume,path,stat);
return ret;
}
static int fuse_getattr(const char *path, struct stat *stbuf)
{
char * c;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
int ret;
log_fuse_event(AFPFSD,LOG_DEBUG,"*** getattr of \"%s\"\n",path);
/* Oddly, we sometimes get <dir1>/<dir2>/(null) for the path */
if (!path) return -EIO;
if ((c=strstr(path,"(null)"))) {
/* We should fix this to make sure it is at the end */
if (c>path) *(c-1)='\0';
}
ret=ml_getattr(volume,path,stbuf);
return ret;
}
static struct afp_volume * global_volume;
#if FUSE_USE_VERSION < 26
static void *afp_init(void) {
#else
static void *afp_init(void * o) {
#endif
struct afp_volume * vol = global_volume;
vol->priv=(void *)((struct fuse_context *)(fuse_get_context()))->fuse;
/* Trigger the daemon that we've started */
if (vol->priv) vol->mounted=1;
pthread_cond_signal(&vol->startup_condition_cond);
return (void *) vol;
}
static struct fuse_operations afp_oper = {
.getattr =fuse_getattr,
.open = fuse_open,
.read = fuse_read,
.readdir = fuse_readdir,
.mkdir = fuse_mkdir,
.readlink = fuse_readlink,
.rmdir = fuse_rmdir,
.unlink = fuse_unlink,
.mknod = fuse_mknod,
.write = fuse_write,
.release= fuse_release,
.chmod=fuse_chmod,
.symlink=fuse_symlink,
.chown=fuse_chown,
.truncate=fuse_truncate,
.rename=fuse_rename,
.utime=fuse_utime,
.destroy=afp_destroy,
.init=afp_init,
.statfs=fuse_statfs,
};
int afp_register_fuse(int fuseargc, char *fuseargv[],struct afp_volume * vol)
{
int ret;
global_volume=vol;
fuse_capture_stderr_start();
#if FUSE_USE_VERSION < 26
ret=fuse_main(fuseargc, fuseargv, &afp_oper);
#else
ret=fuse_main(fuseargc, fuseargv, &afp_oper,(void *) vol);
#endif
return ret;
}

8
fuse/fuse_int.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef __FUSE_INT_H_
#define __FUSE_INT_H_
int afp_register_fuse(int fuseargc, char *fuseargv[],struct afp_volume * vol);
#endif

16
fuse/fuse_internal.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef __FUSE_INTERNAL_H_
#define __FUSE_INTERNAL_H_
#define AFP_CLIENT_INCOMING_BUF 2048
struct fuse_client {
char incoming_string[AFP_CLIENT_INCOMING_BUF];
int incoming_size;
/* char client_string[sizeof(struct afp_server_response) + MAX_CLIENT_RESPONSE]; */
char client_string[1000 + MAX_CLIENT_RESPONSE];
int fd;
struct fuse_client * next;
};
#endif

173
fuse/mount_afp.1 Normal file
View File

@ -0,0 +1,173 @@
.\"
.\" Copyright (c) 2001-2002 Apple Computer, Inc. All rights reserved.
.\"
.\" @APPLE_LICENSE_HEADER_START@
.\"
.\" The contents of this file constitute Original Code as defined in and
.\" are subject to the Apple Public Source License Version 1.1 (the
.\" "License"). You may not use this file except in compliance with the
.\" License. Please obtain a copy of the License at
.\" http://www.apple.com/publicsource and read it before using this file.
.\"
.\" This Original Code and all software distributed under the License are
.\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
.\" License for the specific language governing rights and limitations
.\" under the License.
.\"
.\" @APPLE_LICENSE_HEADER_END@
.\"
.\" ****************************************
.\" *
.\" * mount_afp [-o options] [-i] host[:port][/path] node
.\" *
.\" * Created by randall on Wed May 8 2002.
.\" *
.\" ****************************************
.\"
.\" ****************************************
.\" * Required macros
.\" ****************************************
.Dd Feb 1, 2008
.Dt MOUNT_AFP 8
.Os Mac\ OS\ X
.\"
.\" ****************************************
.\" * NAME section
.\" ****************************************
.Sh NAME
.Nm mount_afp
.Nd mount an afp (AppleShare) filesystem using FUSE
.\"
.\" ****************************************
.\" * SYNOPSIS section
.\" ****************************************
.Sh SYNOPSIS
.Nm
.Op Fl o Ar options
.Ar afp_url
.Ar node
.\"
.\" ****************************************
.\" * DESCRIPTION section
.\" ****************************************
.Sh DESCRIPTION
The
.Nm
command mounts the AFP volume denoted by the afp_url
.Ar afp://[user[;AUTH=uamname][:password]@]host[:port]/volumename
at the mount point indicated by
.Ar node.
.Pp
This is normally a symlink to the
.Xr afp_client 1
executable, which is a full implementation to mount AFP volumes using the FUSE infrastructure. It communicates with afpfsd, a daemon that manages AFP sessions.
.Fp
The arguments and options are:
.Bl -tag -width indent
.It Fl o
Options passed to
.Xr mount 2
are specified with the
.Fl o
option followed by a comma separated string of options.
man page for possible options and their meanings. Additional options supported by the AFP Client are as follows:
.Bl -tag -width indent
.It volpass=<password>
The only available option is "-o volpassword=XXX" to set the volume password (since there is no facility for that in an AFP URL).
.El
.Bl -tag -width indent
.It rw
Mount the volume as writeable. This is the default, so it has no effect.
.El
.Bl -tag -width indent
.It ro
Mount the volume as readonly.
.El
.Bl -tag -width indent
.It group=<groupname>
Mount the volume as groupname.
.El
.Bl -tag -width indent
.It user=<username>
Mount the volume as username.
.El
.It Ar afp_url
There are two forms of afp URL, one for TCP/IP and one for AppleTalk:
.Pp
afp://[user[;AUTH=uamname][:password]@]host[:port]/volume
.Pp
afp:/at/[user[;AUTH=uamname][:password]@]servername[:zonename]/volume
.Pp
Denotes the afp server and sharepoint to mount. It may also contain the username & password
required to log into the server. uamname is the protocol name of the authentication method.
If port is not specified, then port 548 is used.
.It Ar node
Path to mount point, which must be a directory that the user has write permissions for.
.El
.\"
.\" ****************************************
.\" * EXAMPLES section
.\" ****************************************
.Sh EXAMPLES
The following example illustrates how to mount the afp volume
server.company.com/volumename/ at the mount point /Volumes/mntpnt:
.Bd -literal -offset indent
mkdir /Volumes/mntpnt
mount_afp afp://username:userpass@server.company.com/volumename/ /Volumes/mntpnt
.Ed
This example shows the proper url to use to mount the volume guestVolume from
the afp server myserver as guest:
.Bd -literal -offset indent
mkdir /Volumes/guest
mount_afp "afp://;AUTH=No%20User%20Authent@myserver/guestVolume" /Volumes/guest
The following shows how to use a username of "user:name" and password of "p@ssword":
server.company.com/volumename/ at the mount point /Volumes/mntpnt:
.Bd -literal -offset indent
mkdir /Volumes/mntpnt
mount_afp afp://user::name:p@@ssword@server.company.com/volumename/ /Volumes/mntpnt
.Ed
.Ed
This example shows the proper url to use to mount the volume myVolume from
the afp server myserver using Kerberos authentication:
.Bd -literal -offset indent
mkdir /Volumes/myVolume
mount_afp "afp://;AUTH=Client%20Krb%20v2@myserver/myVolume" /Volumes/myVolume
.Ed
.\"
.\" ****************************************
.\" * SEE ALSO section
.\" ****************************************
.Sh SEE ALSO
.Xr afp_client 1 (for a more AFP commands),
.Xr afpcmd 1 (for a non-FUSE command line AFP client),
.\"
.\" ****************************************
.\" * HISTORY section
.\" ****************************************
.Sh HISTORY
The
.Nm
command first appeared Mac OS X version 10.0. Kerberos authentication was added in Mac OS X version 10.2. This syntax (and manpage) was used for afpfs-ng's fuse implementation.
.\"
.\" ****************************************
.\" * RETURN VALUES section
.\" * (errors that mount_afp could return)
.\" ****************************************
.Sh RETURN VALUES
.Bl -tag -width Er
.It 0
.Nm
successfully mounted the volume directory.
.It -1
The server volume could not be mounted.
.El
.Sh SEE ALSO
\fB afp_client(1), afpfsd(1)\fN
.\"

3
include/Makefile.am Normal file
View File

@ -0,0 +1,3 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = afpfs-ng

0
include/Makefile.in Normal file
View File

View File

@ -0,0 +1,6 @@
## Process this file with automake to produce Makefile.in
afpfsincludedir = $(includedir)/afpfs-ng
afpfsinclude_HEADERS = afp.h afp_protocol.h libafpclient.h
nodist_afpfsinclude_HEADERS = codepage.h dsi.h map_def.h midlevel.h uams_def.h utils.h

View File

540
include/afpfs-ng/afp.h Normal file
View File

@ -0,0 +1,540 @@
#ifndef _AFP_H_
#define _AFP_H_
#include <arpa/inet.h>
#include <pthread.h>
#include <netdb.h>
#include <sys/statvfs.h>
#include <pwd.h>
#include <afpfs-ng/afp_protocol.h>
#include <afpfs-ng/libafpclient.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <netinet/in.h>
#define AFPFS_VERSION "0.8.2"
/* This is the maximum AFP version this library supports */
#define AFP_MAX_SUPPORTED_VERSION 32
typedef enum {TCPIP,AT} e_proto;
/* afp_url is used to pass locations around */
struct afp_url {
e_proto protocol;
char username[AFP_MAX_USERNAME_LEN];
char uamname[50];
char password[AFP_MAX_PASSWORD_LEN];
char servername[AFP_SERVER_NAME_UTF8_LEN];
int port;
char volumename[AFP_VOLUME_NAME_UTF8_LEN];
char path[AFP_MAX_PATH];
int requested_version;
char zone[AFP_ZONE_LEN]; /* Only used for Appletalk */
char volpassword[9];;
};
struct afp_token {
unsigned int length;
char data[AFP_TOKEN_MAX_LEN];
};
#define SERVER_MAX_VERSIONS 10
#define SERVER_MAX_UAMS 10
struct afp_rx_buffer {
unsigned int size;
unsigned int maxsize;
char * data;
int errorcode;
};
struct afp_file_info {
unsigned short attributes;
unsigned int did;
unsigned int creation_date;
unsigned int modification_date;
unsigned int backup_date;
unsigned int fileid;
unsigned short offspring;
unsigned char sync;
char finderinfo[32];
char name[AFP_MAX_PATH];
char basename[AFP_MAX_PATH];
char translated_name[AFP_MAX_PATH];
struct afp_unixprivs unixprivs;
unsigned int accessrights;
struct afp_file_info * next;
struct afp_file_info * largelist_next;
unsigned char isdir;
unsigned long long size;
unsigned long long resourcesize;
unsigned int resource;
unsigned short forkid;
struct afp_icon * icon;
int eof;
};
#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_KNOWN 0x1
#define VOLUME_EXTRA_FLAGS_VOL_CHMOD_BROKEN 0x2
#define VOLUME_EXTRA_FLAGS_SHOW_APPLEDOUBLE 0x4
#define VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX 0x8
#define VOLUME_EXTRA_FLAGS_NO_LOCKING 0x10
#define VOLUME_EXTRA_FLAGS_IGNORE_UNIXPRIVS 0x20
#define VOLUME_EXTRA_FLAGS_READONLY 0x40
#define AFP_VOLUME_UNMOUNTED 0
#define AFP_VOLUME_MOUNTED 1
#define AFP_VOLUME_UNMOUNTING 2
struct afp_volume {
unsigned short volid;
char flags; /* This is from afpGetSrvrParms */
unsigned short attributes; /* This is from VolOpen */
unsigned short signature; /* This is fixed or variable */
unsigned int creation_date;
unsigned int modification_date;
unsigned int backup_date;
struct statvfs stat;
unsigned char mounted;
char mountpoint[255];
struct afp_server * server;
char volume_name[AFP_VOLUME_NAME_LEN];
char volume_name_printable[AFP_VOLUME_NAME_UTF8_LEN];
unsigned short dtrefnum;
char volpassword[AFP_VOLPASS_LEN];
unsigned int extra_flags; /* This is an afpfs-ng specific field */
/* Our directory ID cache */
struct did_cache_entry * did_cache_base;
pthread_mutex_t did_cache_mutex;
/* Our journal of open forks */
struct afp_file_info * open_forks;
pthread_mutex_t open_forks_mutex;
/* Used to trigger startup */
pthread_cond_t startup_condition_cond;
struct {
uint64_t hits;
uint64_t misses;
uint64_t expired;
uint64_t force_removed;
} did_cache_stats;
void * priv; /* This is a private structure for fuse/cmdline, etc */
pthread_t thread; /* This is the per-volume thread */
int mapping;
};
#define SERVER_STATE_CONNECTED 1
#define SERVER_STATE_DISCONNECTED 2
enum server_type{
AFPFS_SERVER_TYPE_UNKNOWN,
AFPFS_SERVER_TYPE_NETATALK,
AFPFS_SERVER_TYPE_AIRPORT,
AFPFS_SERVER_TYPE_MACINTOSH,
};
#define is_netatalk(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_NETATALK )
#define is_airport(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_AIRPORT )
#define is_macintosh(x) ( (x)->machine_type == AFPFS_SERVER_TYPE_MACINTOSH )
struct afp_versions {
char *av_name;
int av_number;
};
extern struct afp_versions afp_versions[];
struct afp_server {
/* Our buffer sizes */
unsigned int tx_quantum;
unsigned int rx_quantum;
unsigned int tx_delay;
/* Connection information */
//the linked list returned by getaddrinfo
struct addrinfo *address;
//the address we successfully connected to
struct addrinfo *used_address;
int fd;
/* Some stats, for information only */
struct {
uint64_t runt_packets;
uint64_t incoming_dsi;
uint64_t rx_bytes;
uint64_t tx_bytes;
uint64_t requests_pending;
} stats;
/* General information */
char server_name[AFP_SERVER_NAME_LEN];
char server_name_utf8[AFP_SERVER_NAME_UTF8_LEN];
char server_name_printable[AFP_SERVER_NAME_UTF8_LEN];
char machine_type[17];
char icon[256];
char signature[16];
unsigned short flags;
int connect_state;
enum server_type server_type;
/* This is the time we connected */
time_t connect_time;
/* UAMs */
unsigned int supported_uams;
unsigned int using_uam;
/* Authentication */
char username[AFP_MAX_USERNAME_LEN];
char password[AFP_MAX_PASSWORD_LEN];
/* Session */
struct afp_token token;
char need_resume;
/* Versions */
unsigned char requested_version;
unsigned char versions[SERVER_MAX_VERSIONS];
struct afp_versions *using_version;
/* Volumes */
unsigned char num_volumes;
struct afp_volume * volumes;
void * dsi;
unsigned int exit_flag;
/* Our DSI request queue */
pthread_mutex_t requestid_mutex;
pthread_mutex_t request_queue_mutex;
unsigned short lastrequestid;
unsigned short expectedrequestid;
struct dsi_request * command_requests;
char loginmesg[200];
char path_encoding;
/* This is the data for the incoming buffer */
char * incoming_buffer;
int data_read;
int bufsize;
/* And this is for the outgoing queue */
pthread_mutex_t send_mutex;
/* This is for user mapping */
struct passwd passwd;
unsigned int server_uid, server_gid;
int server_gid_valid;
struct afp_server *next;
/* These are for DSI attention packets */
unsigned int attention_quantum;
unsigned int attention_len;
char * attention_buffer;
};
struct afp_extattr_info {
unsigned int maxsize;
unsigned int size;
char data[1024];
};
struct afp_comment {
unsigned int maxsize;
unsigned int size;
char *data;
};
struct afp_icon {
unsigned int maxsize;
unsigned int size;
char *data;
};
#define AFP_DEFAULT_ATTENTION_QUANTUM 1024
void afp_unixpriv_to_stat(struct afp_file_info *fp,
struct stat *stat);
int init_uams(void) ;
unsigned int find_uam_by_name(const char * name);
char * uam_bitmap_to_string(unsigned int bitmap);
char * get_uam_names_list(void);
unsigned int default_uams_mask(void);
struct afp_volume * find_volume_by_name(struct afp_server * server,
const char * volname);
struct afp_connection_request {
unsigned int uam_mask;
struct afp_url url;
};
void afp_default_url(struct afp_url *url);
int afp_parse_url(struct afp_url * url, const char * toparse, int verbose);
void afp_print_url(struct afp_url * url);
int afp_url_validate(char * url_string, struct afp_url * valid_url);
int afp_list_volnames(struct afp_server * server, char * names, int max);
/* User mapping */
int afp_detect_mapping(struct afp_volume * volume);
/* These are some functions that help with simple status text generation */
int afp_status_header(char * text, int * len);
int afp_status_server(struct afp_server * s,char * text, int * len);
struct afp_server * afp_server_full_connect(void * priv, struct afp_connection_request * req);
void * just_end_it_now(void *other);
void add_fd_and_signal(int fd);
void loop_disconnect(struct afp_server *s);
void afp_wait_for_started_loop(void);
struct afp_versions * pick_version(unsigned char *versions,
unsigned char requested) ;
int pick_uam(unsigned int u1, unsigned int u2);
int afp_server_login(struct afp_server *server,
char * mesg, unsigned int *l, unsigned int max);
int afp_dologin(struct afp_server *server,
unsigned int uam, char * username, char * passwd);
int afp_dopasswd(struct afp_server *server,
unsigned int uam, char * username,
char * oldpasswd, char * newpasswd);
void afp_free_server(struct afp_server **server);
struct afp_server * afp_server_init(struct addrinfo * address);
struct addrinfo * afp_get_address(void * priv, const char * hostname, unsigned int port);
int afp_main_loop(int command_fd);
int afp_main_quick_startup(pthread_t * thread);
int afp_server_destroy(struct afp_server *s) ;
int afp_server_reconnect(struct afp_server * s, char * mesg,
unsigned int *l, unsigned int max);
int afp_server_connect(struct afp_server *s, int full);
struct afp_server * afp_server_complete_connection(
void * priv,
struct afp_server * server,
struct addrinfo * address, unsigned char * versions,
unsigned int uams, char * username, char * password,
unsigned int requested_version, unsigned int uam_mask);
int afp_connect_volume(struct afp_volume * volume, struct afp_server * server,
char * mesg, unsigned int * l, unsigned int max);
int something_is_mounted(struct afp_server * server);
int add_cache_entry(struct afp_file_info * file) ;
struct afp_file_info * get_cache_by_name(char * name);
struct afp_server * find_server_by_address(struct addrinfo * address);
struct afp_server * find_server_by_signature(char * signature);
struct afp_server * find_server_by_name(char * name);
int server_still_valid(struct afp_server * server);
struct afp_server * get_server_base(void);
int afp_server_remove(struct afp_server * server);
int afp_unmount_volume(struct afp_volume * volume);
int afp_unmount_all_volumes(struct afp_server * server);
#define volume_is_readonly(x) (((x)->attributes&kReadOnly) || \
((x)->extra_flags & VOLUME_EXTRA_FLAGS_READONLY))
int afp_opendt(struct afp_volume *volume, 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);
int afp_addcomment(struct afp_volume *volume, unsigned int did,
const char * pathname, char * comment,uint64_t *size);
int afp_geticon(struct afp_volume * volume, unsigned int filecreator,
unsigned int filetype, unsigned char icontype,
unsigned short length, struct afp_icon * icon);
/* Things you want to do to a server */
int afp_getsrvrmsg(struct afp_server *server, unsigned short messagetype,unsigned char utf8, unsigned char block, char * mesg);
int afp_login(struct afp_server *server, char * uaname,
char * userauthinfo, unsigned int userauthinfo_len,
struct afp_rx_buffer *rx);
int afp_changepassword(struct afp_server *server, char * uaname,
char * userauthinfo, unsigned int userauthinfo_len,
struct afp_rx_buffer *rx);
int afp_logincont(struct afp_server *server, unsigned short id,
char * userauthinfo, unsigned int userauthinfo_len,
struct afp_rx_buffer *rx);
int afp_getsessiontoken(struct afp_server * server, int type,
unsigned int timestamp, struct afp_token *outgoing_token,
struct afp_token * incoming_token);
int afp_getsrvrparms(struct afp_server *server);
int afp_logout(struct afp_server *server,unsigned char wait);
int afp_mapname(struct afp_server * server, unsigned char subfunction,
char * name, unsigned int * id);
int afp_mapid(struct afp_server * server, unsigned char subfunction,
unsigned int id, char *name);
int afp_getuserinfo(struct afp_server * server, int thisuser,
unsigned int userid, unsigned short bitmap,
unsigned int *newuid, unsigned int *newgid);
int afp_zzzzz(struct afp_server *server);
int afp_volopen(struct afp_volume * volume,
unsigned short bitmap, char * password);
int afp_flush(struct afp_volume * volume);
int afp_getfiledirparms(struct afp_volume *volume, unsigned int did,
unsigned int filebitmap, unsigned int dirbitmap, const char * pathname,
struct afp_file_info *fp);
int afp_enumerate(struct afp_volume * volume,
unsigned int dirid,
unsigned int filebitmap, unsigned int dirbitmap,
unsigned short reqcount,
unsigned short startindex,
char * path,
struct afp_file_info ** file_p);
int afp_enumerateext2(struct afp_volume * volume,
unsigned int dirid,
unsigned int filebitmap, unsigned int dirbitmap,
unsigned short reqcount,
unsigned long startindex,
char * path,
struct afp_file_info ** file_p);
int afp_openfork(struct afp_volume * volume,
unsigned char forktype,
unsigned int dirid,
unsigned short accessmode,
char * filename,
struct afp_file_info *fp);
int afp_read(struct afp_volume * volume, unsigned short forkid,
uint32_t offset,
uint32_t count, struct afp_rx_buffer * rx);
int afp_readext(struct afp_volume * volume, unsigned short forkid,
uint64_t offset,
uint64_t count, struct afp_rx_buffer * rx);
int afp_getvolparms(struct afp_volume * volume, unsigned short bitmap);
int afp_createdir(struct afp_volume * volume, unsigned int dirid, const char * pathname, unsigned int *did_p);
int afp_delete(struct afp_volume * volume,
unsigned int dirid, char * pathname);
int afp_createfile(struct afp_volume * volume, unsigned char flag,
unsigned int did, char * pathname);
int afp_write(struct afp_volume * volume, unsigned short forkid,
uint32_t offset, uint32_t reqcount,
char * data, uint32_t * written);
int afp_writeext(struct afp_volume * volume, unsigned short forkid,
uint64_t offset, uint64_t reqcount,
char * data, uint64_t * written);
int afp_flushfork(struct afp_volume * volume, unsigned short forkid);
int afp_closefork(struct afp_volume * volume, unsigned short forkid);
int afp_setfileparms(struct afp_volume * volume,
unsigned int dirid, const char * pathname, unsigned short bitmap,
struct afp_file_info *fp);
int afp_setfiledirparms(struct afp_volume * volume,
unsigned int dirid, const char * pathname, unsigned short bitmap,
struct afp_file_info *fp);
int afp_setdirparms(struct afp_volume * volume,
unsigned int dirid, const char * pathname, unsigned short bitmap,
struct afp_file_info *fp);
int afp_volclose(struct afp_volume * volume);
int afp_setforkparms(struct afp_volume *volume,
unsigned short forkid, unsigned short bitmap, unsigned long len);
int afp_byterangelock(struct afp_volume * volume,
unsigned char flag,
unsigned short forkid,
uint32_t offset,
uint32_t len, uint32_t *generated_offset);
int afp_byterangelockext(struct afp_volume * volume,
unsigned char flag,
unsigned short forkid,
uint64_t offset,
uint64_t len, uint64_t *generated_offset);
int afp_moveandrename(struct afp_volume *volume,
unsigned int src_did,
unsigned int dst_did,
char * src_path, char * dst_path, char *new_name);
int afp_rename(struct afp_volume * volume,
unsigned int dirid,
char * path_from, char * path_to);
int afp_listextattr(struct afp_volume * volume,
unsigned int dirid, unsigned short bitmap,
char * pathname, struct afp_extattr_info * info);
/* This is a currently undocumented command */
int afp_newcommand76(struct afp_volume * volume, unsigned int dlen, char * data);
/* For debugging */
char * afp_get_command_name(char code);
#endif

View File

@ -0,0 +1,361 @@
#ifndef _AFP_PROTOCOL_H_
#define _AFP_PROTOCOL_H_
#include <sys/types.h>
#include <stddef.h>
#include <unistd.h>
#include <stdint.h>
/* This file defines constants for the Apple File Protocol.
All page references are from "Apple Filing Protocol Programming" version 3.2.
except where noted.
*/
#define AFP_SERVER_NAME_LEN 33
#define AFP_SERVER_NAME_UTF8_LEN 255
#define AFP_VOLUME_NAME_LEN 33
#define AFP_VOLUME_NAME_UTF8_LEN 33
#define AFP_SIGNATURE_LEN 16
#define AFP_MACHINETYPE_LEN 33
#define AFP_LOGINMESG_LEN 200
#define AFP_VOLPASS_LEN 8
#define AFP_HOSTNAME_LEN 255
/* This is actually just a guess, and only used for appletalk */
#define AFP_ZONE_LEN 255
#define AFP_SERVER_ICON_LEN 256
#define AFP_MAX_USERNAME_LEN 127
#define AFP_MAX_PASSWORD_LEN 127
/* This is the maximum length of any UAM string */
#define AFP_UAM_LENGTH 24
/* This is the maximum length of any path description */
#define AFP_MAX_PATH 768
#define AFP_VOL_FLAT 1
#define AFP_VOL_FIXED 2
#define AFP_VOL_VARIABLE 3
/* The root directory ID, p.26 */
#define AFP_ROOT_DID 2
/* Path type constants, p.249 */
enum {
kFPShortName = 1,
kFPLongName = 2,
kFPUTF8Name = 3
};
/* fork types */
#define AFP_FORKTYPE_DATA 0x0
#define AFP_FORKTYPE_RESOURCE 0x80
/* openfork access modes, from p.196 */
#define AFP_OPENFORK_ALLOWREAD 1
#define AFP_OPENFORK_ALLOWWRITE 2
#define AFP_OPENFORK_DENYREAD 0x10
#define AFP_OPENFORK_DENYWRITE 0x20
/* Message type for getsrvmesg, p. 169*/
typedef enum {
AFPMESG_LOGIN = 0,
AFPMESG_SERVER = 1
} afpmessage_t;
/* Message bitmap for getsrvrmsg */
#define AFP_GETSRVRMSG_UTF8 0x2
#define AFP_GETSRVRMSG_GETMSG 0x1
/* Maximum Version length, p.17 */
#define AFP_MAX_VERSION_LENGTH 16
/* Maximum length of a token, this is undocumented */
#define AFP_TOKEN_MAX_LEN 256
/* The maximum size of a file for AFP 2 */
#define AFP_MAX_AFP2_FILESIZE (4294967296)
/* Unix privs, p.240 */
struct afp_unixprivs {
uint32_t uid __attribute__((__packed__));
uint32_t gid __attribute__((__packed__));
uint32_t permissions __attribute__((__packed__));
uint32_t ua_permissions __attribute__((__packed__));
};
/* AFP Volume attributes bitmap, p.241 */
enum {
kReadOnly = 0x01,
kHasVolumePassword = 0x02,
kSupportsFileIDs = 0x04,
kSupportsCatSearch = 0x08,
kSupportsBlankAccessPrivs = 0x10,
kSupportsUnixPrivs = 0x20,
kSupportsUTF8Names = 0x40,
kNoNetworkUserIDs = 0x80,
kDefaultPrivsFromParent = 0x100,
kNoExchangeFiles = 0x200,
kSupportsExtAttrs = 0x400,
kSupportsACLs=0x800
};
/* AFP file creation constantes, p.250 */
enum {
kFPSoftCreate = 0,
kFPHardCreate = 0x80
};
/* AFP Directory attributes, taken from the protocol guide p.236 */
enum {
kFPAttributeBit = 0x1,
kFPParentDirIDBit = 0x2,
kFPCreateDateBit = 0x4,
kFPModDateBit = 0x8,
kFPBackupDateBit = 0x10,
kFPFinderInfoBit = 0x20,
kFPLongNameBit = 0x40,
kFPShortNameBit = 0x80,
kFPNodeIDBit = 0x100,
kFPOffspringCountBit = 0x0200,
kFPOwnerIDBit = 0x0400,
kFPGroupIDBit = 0x0800,
kFPAccessRightsBit = 0x1000,
kFPProDOSInfoBit = 0x2000, // AFP version 2.2 and earlier
kFPUTF8NameBit = 0x2000, // AFP version 3.0 and later
kFPUnixPrivsBit = 0x8000 // AFP version 3.0 and later
};
/* AFP File bitmap, p.238. These are the ones not in the AFP Directory
attributes map. */
enum {
kFPDataForkLenBit = 0x0200,
kFPRsrcForkLenBit = 0x0400,
kFPExtDataForkLenBit = 0x0800, // AFP version 3.0 and later
kFPLaunchLimitBit = 0x1000,
kFPExtRsrcForkLenBit = 0x4000, // AFP version 3.0 and later
};
/* AFP Extended Attributes Bitmap, p.238 */
enum {
kXAttrNoFollow = 0x1,
kXAttrCreate = 0x2,
kXAttrREplace=0x4
};
/* AFP function codes */
enum AFPFunction
{
afpByteRangeLock = 1, afpCloseVol, afpCloseDir, afpCloseFork,
afpCopyFile, afpCreateDir, afpCreateFile,
afpDelete, afpEnumerate, afpFlush, afpFlushFork,
afpGetForkParms = 14, afpGetSrvrInfo, afpGetSrvrParms,
afpGetVolParms, afpLogin, afpLoginCont, afpLogout, afpMapID,
afpMapName, afpMoveAndRename, afpOpenVol, afpOpenDir, afpOpenFork,
afpRead, afpRename, afpSetDirParms, afpSetFileParms,
afpSetForkParms, afpSetVolParms, afpWrite, afpGetFileDirParms,
afpSetFileDirParms, afpChangePassword,
afpGetUserInfo=37,afpGetSrvrMsg = 38,
afpOpenDT=48,
afpCloseDT=49,
afpGetIcon=51, afpGetIconInfo=52,
afpAddComment=56, afpRemoveComment=57, afpGetComment=58,
afpByteRangeLockExt=59, afpReadExt, afpWriteExt,
afpGetAuthMethods=62,
afp_LoginExt=63,
afpGetSessionToken=64,
afpDisconnectOldSession=65,
afpEnumerateExt=66,
afpCatSearchExt = 67,
afpEnumerateExt2 = 68, afpGetExtAttr, afpSetExtAttr,
afpRemoveExtAttr , afpListExtAttrs,
afpZzzzz = 122,
afpAddIcon=192,
};
/* AFP Volume bitmap. Take from 242 of the protocol guide. */
enum {
kFPBadVolPre222Bitmap = 0xFe00,
kFPBadVolBitmap = 0xF000,
kFPVolAttributeBit = 0x1,
kFPVolSignatureBit = 0x2,
kFPVolCreateDateBit = 0x4,
kFPVolModDateBit = 0x8,
kFPVolBackupDateBit = 0x10,
kFPVolIDBit = 0x20,
kFPVolBytesFreeBit = 0x40,
kFPVolBytesTotalBit = 0x80,
kFPVolNameBit = 0x100,
kFPVolExtBytesFreeBit = 0x200,
kFPVolExtBytesTotalBit = 0x400,
kFPVolBlockSizeBit = 0x800
};
/* AFP Attention Codes -- 4 bits */
#define AFPATTN_SHUTDOWN (1 << 15) /* shutdown/disconnect */
#define AFPATTN_CRASH (1 << 14) /* server crashed */
#define AFPATTN_MESG (1 << 13) /* server has message */
#define AFPATTN_NORECONNECT (1 << 12) /* don't reconnect */
/* server notification */
#define AFPATTN_NOTIFY (AFPATTN_MESG | AFPATTN_NORECONNECT)
/* extended bitmap -- 12 bits. volchanged is only useful w/ a server
* notification, and time is only useful for shutdown. */
#define AFPATTN_VOLCHANGED (1 << 0) /* volume has changed */
#define AFPATTN_TIME(x) ((x) & 0xfff) /* time in minutes */
#define kFPNoErr 0
/* AFP result codes, p252 */
#define kASPSessClosed -1072
#define kFPAccessDenied -5000
#define kFPAuthContinue -5001
#define kFPBadUAM -5002
#define kFPBadVersNum -5003
#define kFPBitmapErr -5004
#define kFPCantMove -5005
#define kFPDenyConflict -5006
#define kFPDirNotEmpty -5007
#define kFPDiskFull -5008
#define kFPEOFErr -5009
#define kFPFileBusy -5010
#define kFPFlatVol -5011
#define kFPItemNotFound -5012
#define kFPLockErr -5013
#define kFPMiscErr -5014
#define kFPNoMoreLocks -5015
#define kFPNoServer -5016
#define kFPObjectExists -5017
#define kFPObjectNotFound -5018
#define kFPParamErr -5019
#define kFPRangeNotLocked -5020
#define kFPRangeOverlap -5021
#define kFPSessClosed -5022
#define kFPUserNotAuth -5023
#define kFPCallNotSupported -5024
#define kFPObjectTypeErr -5025
#define kFPTooManyFilesOpen -5026
#define kFPServerGoingDown -5027
#define kFPCantRename -5028
#define kFPDirNotFound -5029
#define kFPIconTypeError -5030
#define kFPVolLocked -5031
#define kFPObjectLocked -5032
#define kFPContainsSharedErr -5033
#define kFPIDNotFound -5034
#define kFPIDExists -5035
#define kFPDiffVolErr -5036
#define kFPCatalogChanged -5037
#define kFPSameObjectErr -5038
#define kFPBadIDErr -5039
#define kFPPwdSameErr -5040
#define kFPPwdTooShortErr -5041
#define kFPPwdExpiredErr -5042
#define kFPInsideSharedErr -5043
#define kFPInsideTrashErr -5044
#define kFPPwdNeedsChangeErr -5045
#define kFPPwdPolicyErr -5046
#define kFPDiskQuotaExceeded 5047
/* These flags determine to lock or unlock in ByteRangeLock(Ext) */
enum {
ByteRangeLock_Lock = 0,
ByteRangeLock_Unlock = 1
};
/* These flags are used in volopen and getsrvrparm replies, p.171 */
#define HasConfigInfo 0x1
#define HasPassword 0x80
/* These are the subfunction for kFPMapID, as per p.248 */
enum {
kUserIDToName = 1,
kGroupIDToName = 2,
kUserIDToUTF8Name = 3,
kGroupIDToUTF8Name = 4,
kUserUUIDToUTF8Name = 5,
kGroupUUIDToUTF8Name = 6
};
/* These are the subfunction flags described in the FPMapName command, p.286.
Note that this is different than what's described on p. 186. */
enum {
kNameToUserID = 1,
kNameToGroupID = 2,
kUTF8NameToUserID = 3,
kUTF8NameToGroupID = 4,
kUTF8NameToUserUUID = 5,
kUTF8NameToGroupUUID = 6
};
/* These are bits for FPGetUserInfo, p.173. */
#define kFPGetUserInfo_USER_ID 1
#define kFPGetUserInfo_PRI_GROUPID 2
/* Flags for the replies of GetSrvrInfo and DSI GetStatus, p.240 */
enum {
kSupportsCopyfile = 0x01,
kSupportsChgPwd = 0x02,
kDontAllowSavePwd = 0x04,
kSupportsSrvrMsg = 0x08,
kSrvrSig = 0x10,
kSupportsTCP = 0x20,
kSupportsSrvrNotify = 0x40,
kSupportsReconnect = 0x80,
kSupportsDirServices = 0x100,
kSupportsUTF8SrvrName = 0x200,
kSupportsUUIDs = 0x400,
kSupportsSuperClient = 0x8000
};
/* p.247 */
enum {
kLoginWithoutID = 0,
kLoginWithID = 1,
kReconnWithID = 2,
kLoginWithTimeAndID = 3,
kReconnWithTimeAndID = 4,
kRecon1Login = 5,
kRecon1ReconnectLogin = 6,
kRecon1Refresh = 7, kGetKerberosSessionKey = 8
};
#define AFP_CHMOD_ALLOWED_BITS_22 \
(S_IRUSR |S_IWUSR | S_IRGRP | S_IWGRP |S_IROTH | S_IWOTH | S_IFREG )
#endif

View File

@ -0,0 +1,11 @@
#ifndef __CODE_PAGE_H_
#define __CODE_PAGE_H_
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
char * dest, int dest_len);
int convert_utf8pre_to_utf8dec(const char * src, int src_len,
char * dest, int dest_len);
int convert_path_to_unix(char encoding, char * dest,
char * src, int dest_len);
int convert_path_to_afp(char encoding, char * dest,
char * src, int dest_len);
#endif

35
include/afpfs-ng/dsi.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef __DSI_H_
#define __DSI_H_
#include "afpfs-ng/afp.h"
struct dsi_request
{
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);
int dsi_getstatus(struct afp_server * server);
int dsi_opensession(struct afp_server *server);
int dsi_send(struct afp_server *server, char * msg, int size,int wait,unsigned char subcommand, void ** other);
struct dsi_session * dsi_create(struct afp_server *server);
int dsi_restart(struct afp_server *server);
int dsi_recv(struct afp_server * server);
#define DSI_BLOCK_TIMEOUT -1
#define DSI_DONT_WAIT 0
#define DSI_DEFAULT_TIMEOUT 5
#endif

View File

@ -0,0 +1,50 @@
#ifndef __CLIENT_H_
#define __CLIENT_H_
#include <unistd.h>
#include <syslog.h>
#define MAX_CLIENT_RESPONSE 2048
enum loglevels {
AFPFSD,
};
struct afp_server;
struct afp_volume;
struct libafpclient {
int (*unmount_volume) (struct afp_volume * volume);
void (*log_for_client)(void * priv,
enum loglevels loglevel, int logtype, const char *message);
void (*forced_ending_hook)(void);
int (*scan_extra_fds)(int command_fd,fd_set *set, int * max_fd);
void (*loop_started)(void);
} ;
extern struct libafpclient * libafpclient;
void libafpclient_register(struct libafpclient * tmpclient);
void signal_main_thread(void);
/* These are logging functions */
#define MAXLOGSIZE 2048
#define LOG_METHOD_SYSLOG 1
#define LOG_METHOD_STDOUT 2
void set_log_method(int m);
void log_for_client(void * priv,
enum loglevels loglevel, int logtype, char * message,...);
void stdout_log_for_client(void * priv,
enum loglevels loglevel, int logtype, const char *message);
#endif

View File

@ -0,0 +1,15 @@
#ifndef __MAP_H_
#define __MAP_H_
#include "afpfs-ng/afp.h"
#define AFP_MAPPING_UNKNOWN 0
#define AFP_MAPPING_COMMON 1
#define AFP_MAPPING_LOGINIDS 2
#define AFP_MAPPING_NAME 3
unsigned int map_string_to_num(char * name);
char * get_mapping_name(struct afp_volume * volume);
#endif

View File

@ -0,0 +1,64 @@
#ifndef __MIDLEVEL_H_
#define __MIDLEVEL_H_
#include <utime.h>
#include "afpfs-ng/afp.h"
int ml_open(struct afp_volume * volume, const char *path, int flags,
struct afp_file_info **newfp);
int ml_creat(struct afp_volume * volume, const char *path,mode_t mode);
int ml_readdir(struct afp_volume * volume,
const char *path,
struct afp_file_info **base);
int ml_read(struct afp_volume * volume, const char *path,
char *buf, size_t size, off_t offset,
struct afp_file_info *fp, int * eof);
int ml_chmod(struct afp_volume * vol, const char * path, mode_t mode);
int ml_unlink(struct afp_volume * vol, const char *path);
int ml_mkdir(struct afp_volume * vol, const char * path, mode_t mode);
int ml_close(struct afp_volume * volume, const char * path,
struct afp_file_info * fp);
int ml_getattr(struct afp_volume * volume, const char *path,
struct stat *stbuf);
int ml_write(struct afp_volume * volume, const char * path,
const char *data, size_t size, off_t offset,
struct afp_file_info * fp, uid_t uid,
gid_t gid);
int ml_readlink(struct afp_volume * vol, const char * path,
char *buf, size_t size);
int ml_rmdir(struct afp_volume * vol, const char *path);
int ml_chown(struct afp_volume * vol, const char * path,
uid_t uid, gid_t gid);
int ml_truncate(struct afp_volume * vol, const char * path, off_t offset);
int ml_utime(struct afp_volume * vol, const char * path,
struct utimbuf * timebuf);
int ml_symlink(struct afp_volume *vol, const char * path1, const char * path2);
int ml_rename(struct afp_volume * vol,
const char * path_from, const char * path_to);
int ml_statfs(struct afp_volume * vol, const char *path, struct statvfs *stat);
void afp_ml_filebase_free(struct afp_file_info **filebase);
int ml_passwd(struct afp_server *server,
char * username, char * oldpasswd, char * newpasswd);
#endif

View File

@ -0,0 +1,16 @@
#ifndef __UAM_DEFS_H_
#define __UAM_DEFS_H_
#define UAM_NOUSERAUTHENT 0x1
#define UAM_CLEARTXTPASSWRD 0x2
#define UAM_RANDNUMEXCHANGE 0x4
#define UAM_2WAYRANDNUM 0x8
#define UAM_DHCAST128 0x10
#define UAM_CLIENTKRB 0x20
#define UAM_DHX2 0x40
#define UAM_RECON1 0x80
int uam_string_to_bitmap(char * name);
char * uam_bitmap_to_string(unsigned int bitmap);
#endif

43
include/afpfs-ng/utils.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef __UTILS_H_
#define __UTILS_H_
#include <stdio.h>
#include "afpfs-ng/afp.h"
#if BYTE_ORDER == BIG_ENDIAN
#define hton64(x) (x)
#define ntoh64(x) (x)
#else /* BYTE_ORDER == BIG_ENDIAN */
#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 */
#define min(a,b) (((a)<(b)) ? (a) : (b))
#define max(a,b) (((a)>(b)) ? (a) : (b))
unsigned char unixpath_to_afppath(
struct afp_server * server,
char * buf);
unsigned char sizeof_path_header(struct afp_server * server);
unsigned char copy_from_pascal(char *dest, char *pascal,unsigned int max_len) ;
unsigned short copy_from_pascal_two(char *dest, char *pascal,unsigned int max_len);
unsigned char copy_to_pascal(char *dest, const char *src);
unsigned short copy_to_pascal_two(char *dest, const char *src);
void copy_path(struct afp_server * server, char * dest, const char * pathname, unsigned char len);
char * create_path(struct afp_server * server, char * pathname, unsigned short * len);
int invalid_filename(struct afp_server * server, const char * filename);
#endif

325
install-sh Executable file
View File

@ -0,0 +1,325 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2004-04-01.17
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=
transform_arg=
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 -d DIRECTORIES...
In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
In the second, create the directory path DIR.
Options:
-b=TRANSFORMBASENAME
-c copy source (using $cpprog) instead of moving (using $mvprog).
-d create directories instead of installing files.
-g GROUP $chgrp installed files to GROUP.
-m MODE $chmod installed files to MODE.
-o USER $chown installed files to USER.
-s strip installed files (using $stripprog).
-t=TRANSFORM
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
-c) instcmd=$cpprog
shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit 0;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
--version) echo "$0 $scriptversion"; exit 0;;
*) # When -d is used, all remaining arguments are directories to create.
test -n "$dir_arg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
instcmd=:
chmodcmd=
else
instcmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp" || lasterr=$?
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $instcmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
# If we're going to rename the final executable, determine the name now.
if test -z "$transformarg"; then
dstfile=`basename "$dst"`
else
dstfile=`basename "$dst" $transformbasename \
| sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename.
test -z "$dstfile" && dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
trap '(exit $?); exit' 1 2 13 15
# Move or copy the file name to the temp name
$doit $instcmd "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

11
lib/Makefile.am Normal file
View File

@ -0,0 +1,11 @@
libafpclient_la_CFLAGS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/include @CFLAGS@
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 identify.c
# libafpclient_la_LDFLAGS = -module -avoid-version

750
lib/Makefile.in Normal file
View File

@ -0,0 +1,750 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = lib
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libafpclient_la_LIBADD =
am_libafpclient_la_OBJECTS = libafpclient_la-afp.lo \
libafpclient_la-codepage.lo libafpclient_la-did.lo \
libafpclient_la-dsi.lo libafpclient_la-map_def.lo \
libafpclient_la-uams.lo libafpclient_la-uams_def.lo \
libafpclient_la-unicode.lo libafpclient_la-users.lo \
libafpclient_la-utils.lo libafpclient_la-resource.lo \
libafpclient_la-log.lo libafpclient_la-client.lo \
libafpclient_la-server.lo libafpclient_la-connect.lo \
libafpclient_la-loop.lo libafpclient_la-midlevel.lo \
libafpclient_la-proto_attr.lo libafpclient_la-proto_desktop.lo \
libafpclient_la-proto_directory.lo \
libafpclient_la-proto_files.lo libafpclient_la-proto_fork.lo \
libafpclient_la-proto_login.lo libafpclient_la-proto_map.lo \
libafpclient_la-proto_replyblock.lo \
libafpclient_la-proto_server.lo \
libafpclient_la-proto_volume.lo \
libafpclient_la-proto_session.lo libafpclient_la-afp_url.lo \
libafpclient_la-status.lo libafpclient_la-forklist.lo \
libafpclient_la-debug.lo libafpclient_la-lowlevel.lo
libafpclient_la_OBJECTS = $(am_libafpclient_la_OBJECTS)
libafpclient_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libafpclient_la_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libafpclient_la_SOURCES)
DIST_SOURCES = $(libafpclient_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYCLE_OBJ = @CYCLE_OBJ@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBFUSE_LDFLAGS = @LIBFUSE_LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
libafpclient_la_CFLAGS = -D_FILE_OFFSET_BITS=64 -I$(top_srcdir)/include @CFLAGS@
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
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu lib/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libafpclient.la: $(libafpclient_la_OBJECTS) $(libafpclient_la_DEPENDENCIES)
$(libafpclient_la_LINK) -rpath $(libdir) $(libafpclient_la_OBJECTS) $(libafpclient_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-afp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-afp_url.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-client.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-codepage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-connect.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-debug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-did.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-dsi.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-forklist.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-log.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-loop.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-lowlevel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-map_def.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-midlevel.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_attr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_desktop.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_directory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_files.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_fork.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_login.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_map.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_replyblock.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_server.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_session.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-proto_volume.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-resource.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-server.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-status.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-uams.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-uams_def.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-unicode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-users.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libafpclient_la-utils.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
libafpclient_la-afp.lo: afp.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-afp.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-afp.Tpo -c -o libafpclient_la-afp.lo `test -f 'afp.c' || echo '$(srcdir)/'`afp.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-afp.Tpo $(DEPDIR)/libafpclient_la-afp.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='afp.c' object='libafpclient_la-afp.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-afp.lo `test -f 'afp.c' || echo '$(srcdir)/'`afp.c
libafpclient_la-codepage.lo: codepage.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-codepage.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-codepage.Tpo -c -o libafpclient_la-codepage.lo `test -f 'codepage.c' || echo '$(srcdir)/'`codepage.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-codepage.Tpo $(DEPDIR)/libafpclient_la-codepage.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codepage.c' object='libafpclient_la-codepage.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-codepage.lo `test -f 'codepage.c' || echo '$(srcdir)/'`codepage.c
libafpclient_la-did.lo: did.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-did.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-did.Tpo -c -o libafpclient_la-did.lo `test -f 'did.c' || echo '$(srcdir)/'`did.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-did.Tpo $(DEPDIR)/libafpclient_la-did.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='did.c' object='libafpclient_la-did.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-did.lo `test -f 'did.c' || echo '$(srcdir)/'`did.c
libafpclient_la-dsi.lo: dsi.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-dsi.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-dsi.Tpo -c -o libafpclient_la-dsi.lo `test -f 'dsi.c' || echo '$(srcdir)/'`dsi.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-dsi.Tpo $(DEPDIR)/libafpclient_la-dsi.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dsi.c' object='libafpclient_la-dsi.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-dsi.lo `test -f 'dsi.c' || echo '$(srcdir)/'`dsi.c
libafpclient_la-map_def.lo: map_def.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-map_def.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-map_def.Tpo -c -o libafpclient_la-map_def.lo `test -f 'map_def.c' || echo '$(srcdir)/'`map_def.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-map_def.Tpo $(DEPDIR)/libafpclient_la-map_def.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='map_def.c' object='libafpclient_la-map_def.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-map_def.lo `test -f 'map_def.c' || echo '$(srcdir)/'`map_def.c
libafpclient_la-uams.lo: uams.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-uams.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-uams.Tpo -c -o libafpclient_la-uams.lo `test -f 'uams.c' || echo '$(srcdir)/'`uams.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-uams.Tpo $(DEPDIR)/libafpclient_la-uams.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='uams.c' object='libafpclient_la-uams.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-uams.lo `test -f 'uams.c' || echo '$(srcdir)/'`uams.c
libafpclient_la-uams_def.lo: uams_def.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-uams_def.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-uams_def.Tpo -c -o libafpclient_la-uams_def.lo `test -f 'uams_def.c' || echo '$(srcdir)/'`uams_def.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-uams_def.Tpo $(DEPDIR)/libafpclient_la-uams_def.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='uams_def.c' object='libafpclient_la-uams_def.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-uams_def.lo `test -f 'uams_def.c' || echo '$(srcdir)/'`uams_def.c
libafpclient_la-unicode.lo: unicode.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-unicode.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-unicode.Tpo -c -o libafpclient_la-unicode.lo `test -f 'unicode.c' || echo '$(srcdir)/'`unicode.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-unicode.Tpo $(DEPDIR)/libafpclient_la-unicode.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='unicode.c' object='libafpclient_la-unicode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-unicode.lo `test -f 'unicode.c' || echo '$(srcdir)/'`unicode.c
libafpclient_la-users.lo: users.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-users.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-users.Tpo -c -o libafpclient_la-users.lo `test -f 'users.c' || echo '$(srcdir)/'`users.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-users.Tpo $(DEPDIR)/libafpclient_la-users.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='users.c' object='libafpclient_la-users.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-users.lo `test -f 'users.c' || echo '$(srcdir)/'`users.c
libafpclient_la-utils.lo: utils.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-utils.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-utils.Tpo -c -o libafpclient_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-utils.Tpo $(DEPDIR)/libafpclient_la-utils.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='libafpclient_la-utils.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
libafpclient_la-resource.lo: resource.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-resource.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-resource.Tpo -c -o libafpclient_la-resource.lo `test -f 'resource.c' || echo '$(srcdir)/'`resource.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-resource.Tpo $(DEPDIR)/libafpclient_la-resource.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='resource.c' object='libafpclient_la-resource.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-resource.lo `test -f 'resource.c' || echo '$(srcdir)/'`resource.c
libafpclient_la-log.lo: log.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-log.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-log.Tpo -c -o libafpclient_la-log.lo `test -f 'log.c' || echo '$(srcdir)/'`log.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-log.Tpo $(DEPDIR)/libafpclient_la-log.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='log.c' object='libafpclient_la-log.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-log.lo `test -f 'log.c' || echo '$(srcdir)/'`log.c
libafpclient_la-client.lo: client.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-client.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-client.Tpo -c -o libafpclient_la-client.lo `test -f 'client.c' || echo '$(srcdir)/'`client.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-client.Tpo $(DEPDIR)/libafpclient_la-client.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client.c' object='libafpclient_la-client.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-client.lo `test -f 'client.c' || echo '$(srcdir)/'`client.c
libafpclient_la-server.lo: server.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-server.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-server.Tpo -c -o libafpclient_la-server.lo `test -f 'server.c' || echo '$(srcdir)/'`server.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-server.Tpo $(DEPDIR)/libafpclient_la-server.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='server.c' object='libafpclient_la-server.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-server.lo `test -f 'server.c' || echo '$(srcdir)/'`server.c
libafpclient_la-connect.lo: connect.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-connect.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-connect.Tpo -c -o libafpclient_la-connect.lo `test -f 'connect.c' || echo '$(srcdir)/'`connect.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-connect.Tpo $(DEPDIR)/libafpclient_la-connect.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='connect.c' object='libafpclient_la-connect.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-connect.lo `test -f 'connect.c' || echo '$(srcdir)/'`connect.c
libafpclient_la-loop.lo: loop.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-loop.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-loop.Tpo -c -o libafpclient_la-loop.lo `test -f 'loop.c' || echo '$(srcdir)/'`loop.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-loop.Tpo $(DEPDIR)/libafpclient_la-loop.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loop.c' object='libafpclient_la-loop.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-loop.lo `test -f 'loop.c' || echo '$(srcdir)/'`loop.c
libafpclient_la-midlevel.lo: midlevel.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-midlevel.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-midlevel.Tpo -c -o libafpclient_la-midlevel.lo `test -f 'midlevel.c' || echo '$(srcdir)/'`midlevel.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-midlevel.Tpo $(DEPDIR)/libafpclient_la-midlevel.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='midlevel.c' object='libafpclient_la-midlevel.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-midlevel.lo `test -f 'midlevel.c' || echo '$(srcdir)/'`midlevel.c
libafpclient_la-proto_attr.lo: proto_attr.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_attr.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_attr.Tpo -c -o libafpclient_la-proto_attr.lo `test -f 'proto_attr.c' || echo '$(srcdir)/'`proto_attr.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_attr.Tpo $(DEPDIR)/libafpclient_la-proto_attr.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_attr.c' object='libafpclient_la-proto_attr.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_attr.lo `test -f 'proto_attr.c' || echo '$(srcdir)/'`proto_attr.c
libafpclient_la-proto_desktop.lo: proto_desktop.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_desktop.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_desktop.Tpo -c -o libafpclient_la-proto_desktop.lo `test -f 'proto_desktop.c' || echo '$(srcdir)/'`proto_desktop.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_desktop.Tpo $(DEPDIR)/libafpclient_la-proto_desktop.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_desktop.c' object='libafpclient_la-proto_desktop.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_desktop.lo `test -f 'proto_desktop.c' || echo '$(srcdir)/'`proto_desktop.c
libafpclient_la-proto_directory.lo: proto_directory.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_directory.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_directory.Tpo -c -o libafpclient_la-proto_directory.lo `test -f 'proto_directory.c' || echo '$(srcdir)/'`proto_directory.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_directory.Tpo $(DEPDIR)/libafpclient_la-proto_directory.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_directory.c' object='libafpclient_la-proto_directory.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_directory.lo `test -f 'proto_directory.c' || echo '$(srcdir)/'`proto_directory.c
libafpclient_la-proto_files.lo: proto_files.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_files.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_files.Tpo -c -o libafpclient_la-proto_files.lo `test -f 'proto_files.c' || echo '$(srcdir)/'`proto_files.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_files.Tpo $(DEPDIR)/libafpclient_la-proto_files.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_files.c' object='libafpclient_la-proto_files.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_files.lo `test -f 'proto_files.c' || echo '$(srcdir)/'`proto_files.c
libafpclient_la-proto_fork.lo: proto_fork.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_fork.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_fork.Tpo -c -o libafpclient_la-proto_fork.lo `test -f 'proto_fork.c' || echo '$(srcdir)/'`proto_fork.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_fork.Tpo $(DEPDIR)/libafpclient_la-proto_fork.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_fork.c' object='libafpclient_la-proto_fork.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_fork.lo `test -f 'proto_fork.c' || echo '$(srcdir)/'`proto_fork.c
libafpclient_la-proto_login.lo: proto_login.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_login.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_login.Tpo -c -o libafpclient_la-proto_login.lo `test -f 'proto_login.c' || echo '$(srcdir)/'`proto_login.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_login.Tpo $(DEPDIR)/libafpclient_la-proto_login.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_login.c' object='libafpclient_la-proto_login.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_login.lo `test -f 'proto_login.c' || echo '$(srcdir)/'`proto_login.c
libafpclient_la-proto_map.lo: proto_map.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_map.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_map.Tpo -c -o libafpclient_la-proto_map.lo `test -f 'proto_map.c' || echo '$(srcdir)/'`proto_map.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_map.Tpo $(DEPDIR)/libafpclient_la-proto_map.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_map.c' object='libafpclient_la-proto_map.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_map.lo `test -f 'proto_map.c' || echo '$(srcdir)/'`proto_map.c
libafpclient_la-proto_replyblock.lo: proto_replyblock.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_replyblock.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_replyblock.Tpo -c -o libafpclient_la-proto_replyblock.lo `test -f 'proto_replyblock.c' || echo '$(srcdir)/'`proto_replyblock.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_replyblock.Tpo $(DEPDIR)/libafpclient_la-proto_replyblock.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_replyblock.c' object='libafpclient_la-proto_replyblock.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_replyblock.lo `test -f 'proto_replyblock.c' || echo '$(srcdir)/'`proto_replyblock.c
libafpclient_la-proto_server.lo: proto_server.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_server.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_server.Tpo -c -o libafpclient_la-proto_server.lo `test -f 'proto_server.c' || echo '$(srcdir)/'`proto_server.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_server.Tpo $(DEPDIR)/libafpclient_la-proto_server.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_server.c' object='libafpclient_la-proto_server.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_server.lo `test -f 'proto_server.c' || echo '$(srcdir)/'`proto_server.c
libafpclient_la-proto_volume.lo: proto_volume.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_volume.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_volume.Tpo -c -o libafpclient_la-proto_volume.lo `test -f 'proto_volume.c' || echo '$(srcdir)/'`proto_volume.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_volume.Tpo $(DEPDIR)/libafpclient_la-proto_volume.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_volume.c' object='libafpclient_la-proto_volume.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_volume.lo `test -f 'proto_volume.c' || echo '$(srcdir)/'`proto_volume.c
libafpclient_la-proto_session.lo: proto_session.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-proto_session.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-proto_session.Tpo -c -o libafpclient_la-proto_session.lo `test -f 'proto_session.c' || echo '$(srcdir)/'`proto_session.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-proto_session.Tpo $(DEPDIR)/libafpclient_la-proto_session.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='proto_session.c' object='libafpclient_la-proto_session.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-proto_session.lo `test -f 'proto_session.c' || echo '$(srcdir)/'`proto_session.c
libafpclient_la-afp_url.lo: afp_url.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-afp_url.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-afp_url.Tpo -c -o libafpclient_la-afp_url.lo `test -f 'afp_url.c' || echo '$(srcdir)/'`afp_url.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-afp_url.Tpo $(DEPDIR)/libafpclient_la-afp_url.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='afp_url.c' object='libafpclient_la-afp_url.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-afp_url.lo `test -f 'afp_url.c' || echo '$(srcdir)/'`afp_url.c
libafpclient_la-status.lo: status.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-status.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-status.Tpo -c -o libafpclient_la-status.lo `test -f 'status.c' || echo '$(srcdir)/'`status.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-status.Tpo $(DEPDIR)/libafpclient_la-status.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='status.c' object='libafpclient_la-status.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-status.lo `test -f 'status.c' || echo '$(srcdir)/'`status.c
libafpclient_la-forklist.lo: forklist.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-forklist.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-forklist.Tpo -c -o libafpclient_la-forklist.lo `test -f 'forklist.c' || echo '$(srcdir)/'`forklist.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-forklist.Tpo $(DEPDIR)/libafpclient_la-forklist.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='forklist.c' object='libafpclient_la-forklist.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-forklist.lo `test -f 'forklist.c' || echo '$(srcdir)/'`forklist.c
libafpclient_la-debug.lo: debug.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-debug.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-debug.Tpo -c -o libafpclient_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-debug.Tpo $(DEPDIR)/libafpclient_la-debug.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='debug.c' object='libafpclient_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
libafpclient_la-lowlevel.lo: lowlevel.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -MT libafpclient_la-lowlevel.lo -MD -MP -MF $(DEPDIR)/libafpclient_la-lowlevel.Tpo -c -o libafpclient_la-lowlevel.lo `test -f 'lowlevel.c' || echo '$(srcdir)/'`lowlevel.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libafpclient_la-lowlevel.Tpo $(DEPDIR)/libafpclient_la-lowlevel.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lowlevel.c' object='libafpclient_la-lowlevel.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libafpclient_la_CFLAGS) $(CFLAGS) -c -o libafpclient_la-lowlevel.lo `test -f 'lowlevel.c' || echo '$(srcdir)/'`lowlevel.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libLTLIBRARIES
# libafpclient_la_LDFLAGS = -module -avoid-version
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

806
lib/afp.c Normal file
View File

@ -0,0 +1,806 @@
/*
* afp.c
*
* Copyright (C) 2006 Alex deVries
* Portions copyright (C) 2007 Derrik Pates
*
*/
#include "afpfs-ng/afp.h"
#include <config.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "afpfs-ng/afp_protocol.h"
#include "afpfs-ng/libafpclient.h"
#include "server.h"
#include "afpfs-ng/dsi.h"
#include "dsi_protocol.h"
#include "afpfs-ng/utils.h"
#include "afp_replies.h"
#include "afp_internal.h"
#include "did.h"
#include "forklist.h"
#include "afpfs-ng/codepage.h"
struct afp_versions afp_versions[] = {
{ "AFPVersion 1.1", 11 },
{ "AFPVersion 2.0", 20 },
{ "AFPVersion 2.1", 21 },
{ "AFP2.2", 22 },
{ "AFPX03", 30 },
{ "AFP3.1", 31 },
{ "AFP3.2", 32 },
{ NULL, 0}
};
static int afp_blank_reply(struct afp_server *server, char * buf, unsigned int size, void * ignored);
int (*afp_replies[])(struct afp_server * server,char * buf, unsigned int len, void * other) = {
NULL, afp_byterangelock_reply, afp_blank_reply, NULL,
afp_blank_reply, NULL, afp_createdir_reply, afp_blank_reply, /* 0 - 7 */
afp_blank_reply, afp_enumerate_reply, afp_blank_reply, afp_blank_reply,
NULL, NULL, NULL, NULL, /* 8 - 15 */
afp_getsrvrparms_reply, afp_getvolparms_reply, afp_login_reply, afp_login_reply,
afp_blank_reply, afp_mapid_reply, afp_mapname_reply, afp_blank_reply, /*16 - 23 */
afp_volopen_reply, NULL, afp_openfork_reply, afp_read_reply,
afp_blank_reply, afp_blank_reply, afp_blank_reply, afp_blank_reply, /*24 - 31 */
NULL, afp_write_reply, afp_getfiledirparms_reply, afp_blank_reply,
afp_changepassword_reply, afp_getuserinfo_reply, afp_getsrvrmsg_reply, NULL, /*32 - 39 */
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, /*40 - 47 */
afp_opendt_reply, afp_blank_reply, NULL, afp_geticon_reply,
NULL, NULL, NULL, NULL, /*48 - 55 */
afp_blank_reply, NULL, afp_getcomment_reply, afp_byterangelockext_reply,
afp_readext_reply, afp_writeext_reply,
NULL, NULL, /*56 - 63 */
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, afp_blank_reply, afp_blank_reply, /*72 - 79 */
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
};
/*
* 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;
}
/* This is the simplest afp reply */
static int afp_blank_reply(struct afp_server *server, char * buf, unsigned int size, void * ignored)
{
struct {
struct dsi_header header __attribute__((__packed__));
} * reply = (void *) buf;
return reply->header.return_code.error_code;
}
/* Handle a reply packet */
int afp_reply(unsigned short subcommand, struct afp_server * server, void * other)
{
int ret=0;
/* No AFP packet is valid if it is smaller than a DSI header. */
if (server->data_read<sizeof(struct dsi_header))
return -1;
if (afp_replies[subcommand]) {
ret=(*afp_replies[subcommand])(server,
server->incoming_buffer,
server->data_read, other);
} else {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"AFP subcommand %d not supported\n",subcommand);
}
return ret;
}
static struct afp_server * server_base=NULL;
int server_still_valid(struct afp_server * server)
{
struct afp_server * s = server_base;
for (;s;s=s->next)
if (s==server) return 1;
return 0;
}
static void add_server(struct afp_server *newserver)
{
newserver->next=server_base;
server_base=newserver;
}
struct afp_server * get_server_base(void)
{
return server_base;
}
struct afp_server * find_server_by_signature(char * signature)
{
struct afp_server * s;
for (s=get_server_base();s;s=s->next) {
if (memcmp(s->signature,signature,AFP_SIGNATURE_LEN)==0) {
return s;
}
}
return NULL;
}
struct afp_server * find_server_by_name(char * name)
{
struct afp_server * s;
for (s=get_server_base(); s; s=s->next) {
if (strcmp(s->server_name_utf8,name)==0) return s;
if (strcmp(s->server_name,name)==0) return s;
}
return NULL;
}
struct afp_server * find_server_by_address(struct addrinfo *address)
{
struct afp_server *s;
for (s=server_base;s;s=s->next) {
if (s->used_address != NULL && s->used_address->ai_addr != NULL &&
address != NULL && address->ai_addr != NULL &&
bcmp(&s->used_address->ai_addr, &address->ai_addr,
sizeof(struct sockaddr))==0) {
return s;
}
}
return NULL;
}
int something_is_mounted(struct afp_server * server)
{
int i;
for (i=0;i<server->num_volumes;i++) {
if (server->volumes[i].mounted != AFP_VOLUME_UNMOUNTED )
return 1;
}
return 0;
}
int afp_unmount_all_volumes(struct afp_server * server)
{
int i;
for (i=0;i<server->num_volumes;i++) {
if (server->volumes[i].mounted == AFP_VOLUME_MOUNTED) {
if (afp_unmount_volume(&server->volumes[i]))
return 1;
}
}
return 0;
}
int afp_unmount_volume(struct afp_volume * volume)
{
struct afp_server * server;
if (volume==NULL)
return -1;
server=volume->server;
if (volume->mounted != AFP_VOLUME_MOUNTED) {
return -1;
}
volume->mounted=AFP_VOLUME_UNMOUNTING;
/* close the volume */
afp_flush(volume);
free_entire_did_cache(volume);
remove_fork_list(volume);
if (volume->dtrefnum) afp_closedt(server,volume->dtrefnum);
volume->dtrefnum=0;
if (libafpclient->unmount_volume)
libafpclient->unmount_volume(volume);
volume->mounted=AFP_VOLUME_UNMOUNTED;
/* Figure out if this is the last volume of the server */
if (something_is_mounted(server)) return 0;
/* Logout */
afp_logout(server,DSI_DONT_WAIT /* don't wait */);
afp_server_remove(server);
return -1;
}
void afp_free_server(struct afp_server ** sp)
{
struct dsi_request * p, *next;
struct afp_volume * volumes;
struct afp_server * server;
if (sp==NULL) return;
server=*sp;
if (!server) return;
for (p=server->command_requests;p;) {
log_for_client(NULL,AFPFSD,LOG_NOTICE,"FSLeft in queue: %p, id: %d command: %d\n", p,p->requestid,p->subcommand);
next=p->next;
free(p);
p=next;
}
volumes=server->volumes;
loop_disconnect(server);
if (server->incoming_buffer) free(server->incoming_buffer);
if (server->attention_buffer) free(server->attention_buffer);
if (volumes) free(volumes);
free(server);
*sp=NULL;
}
int afp_server_remove(struct afp_server *s)
{
struct dsi_request * p;
struct afp_server *s2;
if (s==NULL)
goto out;
for (p=s->command_requests;p;p=p->next) {
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) {
server_base=s->next;
afp_free_server(&s);
goto out;
}
for (s2=server_base;s2;s2=s2->next) {
if (s==s2->next) {
s2->next=s->next;
afp_free_server(&s);
goto out;
}
}
return -1;
out:
return 0;
}
struct afp_server * afp_server_init(struct addrinfo * address)
{
struct afp_server * s;
struct passwd *pw;
if ((s = malloc(sizeof(*s)))==NULL)
return NULL;
memset((void *) s, 0, sizeof(*s));
s->exit_flag = 0;
s->path_encoding=kFPUTF8Name; /* This is a default */
s->next=NULL;
s->bufsize=4096;
s->incoming_buffer=malloc(s->bufsize);
s->attention_quantum=AFP_DEFAULT_ATTENTION_QUANTUM;
s->attention_buffer=malloc(s->attention_quantum);
s->attention_len=0;
s->connect_state=SERVER_STATE_DISCONNECTED;
s->address = address;
/* FIXME this shouldn't be set here */
pw=getpwuid(geteuid());
memcpy(&s->passwd,pw,sizeof(struct passwd));
return s;
}
static void setup_default_outgoing_token(struct afp_token * token)
{
char foo[] = {0x54,0xc0,0x75,0xb0,0x15,0xe6,0x1c,0x13,
0x86,0x75,0xd2,0xc2,0xfd,0x03,0x4e,0x3b};
token->length=16;
memcpy(token->data,foo,16);
}
static int resume_token(struct afp_server * server)
{
struct afp_token outgoing_token;
time_t now;
int ret;
/* Get the time */
time(&now);
/* Setup the outgoing token */
setup_default_outgoing_token(&outgoing_token);
ret=afp_getsessiontoken(server,kReconnWithTimeAndID,
(unsigned int) now,
&outgoing_token,&server->token);
return ret;
}
static int setup_token(struct afp_server * server)
{
time_t now;
int ret;
struct afp_token outgoing_token;
/* Get the time */
time(&now);
/* Setup the outgoing token */
setup_default_outgoing_token(&outgoing_token);
ret=afp_getsessiontoken(server,kLoginWithTimeAndID,
(unsigned int) now,
&outgoing_token,&server->token);
return ret;
}
int afp_server_login(struct afp_server *server,
char * mesg, unsigned int *l, unsigned int max)
{
int rc;
rc=afp_dologin(server,server->using_uam,
server->username,server->password);
switch(rc) {
case -1:
*l+=snprintf(mesg,max-*l,
"Could not find a valid UAM\n");
goto error;
case kFPAuthContinue:
*l+=snprintf(mesg,max-*l,
"Authentication method unsupported by AFPFS\n");
goto error;
case kFPBadUAM:
*l+=snprintf(mesg,max-*l,
"Specified UAM is unknown\n");
goto error;
case kFPBadVersNum:
*l+=snprintf(mesg,max-*l,
"Server does not support this AFP version\n");
case kFPCallNotSupported:
case kFPMiscErr:
*l+=snprintf(mesg,max-*l,
"Already logged in\n");
break;
case kFPNoServer:
*l+=snprintf(mesg,max-*l,
"Authentication server not responding\n");
goto error;
case kFPPwdExpiredErr:
case kFPPwdNeedsChangeErr:
*l+=snprintf(mesg,max-*l,
"Warning: password needs changing\n");
goto error;
case kFPServerGoingDown:
*l+=snprintf(mesg,max-*l,
"Server going down, so I can't log you in.\n");
goto error;
case kFPUserNotAuth:
*l+=snprintf(mesg,max-*l,
"Authentication failed\n");
goto error;
case 0: break;
default:
*l+=snprintf(mesg,max-*l,
"Unknown error, maybe username/passwd needed?\n");
goto error;
}
if (server->flags & kSupportsReconnect) {
/* Get the session */
if (server->need_resume) {
resume_token(server);
server->need_resume=0;
} else {
setup_token(server);
}
}
return 0;
error:
return 1;
}
struct afp_volume * find_volume_by_name(struct afp_server * server,
const char * volname)
{
int i;
struct afp_volume * using_volume=NULL;
char converted_volname[AFP_VOLUME_NAME_LEN];
memset(converted_volname,0,AFP_VOLUME_NAME_LEN);
convert_utf8pre_to_utf8dec(volname,strlen(volname),
converted_volname,AFP_VOLUME_NAME_LEN);
for (i=0;i<server->num_volumes;i++) {
if (strcmp(converted_volname,
server->volumes[i].volume_name_printable)==0)
{
using_volume=&server->volumes[i];
goto out;
}
}
out:
return using_volume;
}
int afp_connect_volume(struct afp_volume * volume, struct afp_server * server,
char * mesg, unsigned int * l, unsigned int max)
{
unsigned short bitmap=
kFPVolAttributeBit|kFPVolSignatureBit|
kFPVolCreateDateBit|kFPVolIDBit |
kFPVolNameBit;
char new_encoding;
int ret;
if (server->using_version->av_number>=30)
bitmap|= kFPVolNameBit|kFPVolBlockSizeBit;
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");
goto error;
case kFPNoErr:
break;
case kFPBitmapErr:
case kFPMiscErr:
case kFPObjectNotFound:
case kFPParamErr:
*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
* the server's. */
if (volume->attributes & kSupportsUTF8Names)
new_encoding=kFPUTF8Name;
else
new_encoding=kFPLongName;
if (new_encoding != server->path_encoding) {
*l+=snprintf(mesg,max-*l,
"Volume %s changes the server's encoding\n",
volume->volume_name_printable);
}
server->path_encoding=new_encoding;
if (volume->signature != AFP_VOL_FIXED) {
*l+=snprintf(mesg,max-*l,
"Volume %s does not support fixed directories\n",
volume->volume_name_printable);
afp_unmount_volume(volume);
goto error;
}
if (server->using_version->av_number >=30) {
if ((volume->server->server_type==AFPFS_SERVER_TYPE_NETATALK) &&
(~ volume->attributes & kSupportsUnixPrivs)) {
volume->extra_flags &=~VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX;
} else {
volume->extra_flags |= VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX;
}
} else {
/* This is very odd, but AFP 2.x doesn't give timestamps for directories */
}
volume->mounted=AFP_VOLUME_MOUNTED;
return 0;
error:
return 1;
}
int afp_server_reconnect(struct afp_server * s, char * mesg,
unsigned int *l, unsigned int max)
{
int i;
struct afp_volume * v;
if (afp_server_connect(s,0)) {
*l+=snprintf(mesg,max-*l,"Error resuming connection to %s\n",
s->server_name_printable);
return 1;
}
dsi_opensession(s);
if(afp_server_login(s,mesg,l,max)) return 1;
for (i=0;i<s->num_volumes;i++) {
v=&s->volumes[i];
if (strlen(v->mountpoint)) {
if (afp_connect_volume(v,v->server,mesg,l,max))
*l+=snprintf(mesg,max-*l,
"Could not mount %s\n",
v->volume_name_printable);
}
}
return 0;
}
int afp_server_connect(struct afp_server *server, int full)
{
int error = 0;
struct timeval t1, t2;
struct addrinfo *address;
char log_msg[64];
char ip_addr[INET6_ADDRSTRLEN];
address = server->address;
while (address)
{
switch(address->ai_family)
{
case AF_INET6:
inet_ntop(AF_INET6, &(((struct sockaddr_in6 *)address->ai_addr)->sin6_addr),
ip_addr, INET6_ADDRSTRLEN);
break;
case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)address->ai_addr)->sin_addr),
ip_addr, INET6_ADDRSTRLEN);
break;
default:
snprintf(ip_addr, 22, "unknown address family");
break;
}
snprintf(log_msg, sizeof(log_msg), "trying %s ...", ip_addr);
log_for_client(NULL, AFPFSD, LOG_NOTICE, log_msg);
server->fd = socket(address->ai_family,
address->ai_socktype, address->ai_protocol);
if (server->fd >= 0)
{
if (connect(server->fd, address->ai_addr, address->ai_addrlen) == 0)
break;
close(server->fd);
server->fd = -1;
}
address = address->ai_next;
}
if(server->fd < 0)
{
error = errno;
goto error;
}
server->exit_flag = 0;
server->lastrequestid = 0;
server->connect_state = SERVER_STATE_CONNECTED;
server->used_address = address;
add_server(server);
add_fd_and_signal(server->fd);
if (!full) {
return 0;
}
/* 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
server->tx_delay= (t2.tv_usec - t1.tv_usec) / 1000;
/* Calculate the quantum based on our tx_delay and a threshold */
/* For now, we'll just set a default */
/* This is the default in 10.4.x where x > 7 */
server->rx_quantum = 128 * 1024;
return 0;
error:
return -error;
}
struct afp_versions * pick_version(unsigned char *versions,
unsigned char requested)
{
/* Pick the right version number. This means either the
one requested or the last one. Set both the number and the
string. */
int i;
char version_num=0;
char found_version=0;
struct afp_versions * p;
char highest=0;
if (requested)
requested= min(requested,AFP_MAX_SUPPORTED_VERSION);
for (i=0;versions[i] && (i<SERVER_MAX_VERSIONS);i++) {
version_num=versions[i];
highest=max(highest,version_num);
if (versions[i]==requested) {
found_version=1;
break;
}
};
if (!found_version)
version_num=highest;
for (p=afp_versions;p->av_name;p++) {
if (p->av_number==version_num) {
return p;
}
}
return NULL;
}
int pick_uam(unsigned int uam2, unsigned int uam1)
{
int i;
for (i=15;i>=0;i--) {
if ( ((1<<i)) & (uam2 & uam1)) return (1<<i);
}
return -1;
}
int afp_list_volnames(struct afp_server * server, char * names, int max)
{
int len=0;
int i;
for (i=0;i<server->num_volumes;i++) {
if (i<server->num_volumes-1)
len+=snprintf(names+len,max-len,"%s, ",
server->volumes[i].volume_name_printable);
else
len+=snprintf(names+len,max-len,"%s",
server->volumes[i].volume_name_printable);
}
return len;
}

16
lib/afp_internal.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef _AFP_INTERNAL_H_
#define _AFP_INTERNAL_H_
#include "afpfs-ng/afp.h"
extern struct afp_versions afp_versions[];
/* From netatalk's adouble.h */
#define AD_DATE_DELTA 946684800
#define AD_DATE_FROM_UNIX(x) (htonl((x) - AD_DATE_DELTA))
#define AD_DATE_TO_UNIX(x) (ntohl(x) + AD_DATE_DELTA)
void add_file_by_name(struct afp_file_info ** base, const char *filename);
#endif

64
lib/afp_replies.h Normal file
View File

@ -0,0 +1,64 @@
#ifndef __AFP_REPLIES_H_
#define __AFP_REPLIES_H_
int parse_reply_block(struct afp_server *server, char * buf,
unsigned int size, unsigned char isdir,
unsigned int filebitmap, unsigned int dirbitmap,
struct afp_file_info * filecur);
int afp_reply(unsigned short subcommand, struct afp_server * server, void * other);
int afp_opendt_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_getcomment_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_geticon_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_login_reply(struct afp_server *server, char *buf, unsigned int size,
void *other);
int afp_changepassword_reply(struct afp_server *server, char *buf,
unsigned int size, void * other);
int afp_getsessiontoken_reply(struct afp_server *server, char *buf,
unsigned int size, void * other);
int afp_getsrvrparms_reply(struct afp_server *server, char * msg, unsigned int size, void * other);
int afp_getsrvrmsg_reply(struct afp_server *server, char *buf, unsigned int size, void * other);
int afp_mapname_reply(struct afp_server *server, char * buf, unsigned int size, void *other);
int afp_mapid_reply(struct afp_server *server, char * buf, unsigned int size, void *other);
int afp_getuserinfo_reply(struct afp_server *server, char * buf, unsigned int size, void *other);
int afp_volopen_reply(struct afp_server *server, char * buf, unsigned int size, void * ignored);
int afp_getfiledirparms_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_enumerate_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_enumerateext2_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_getvolparms_reply(struct afp_server *server, char * buf, unsigned int size,void * other);
int afp_openfork_reply(struct afp_server *server, char * buf, unsigned int size, void * x);
int afp_createdir_reply(struct afp_server * server, char * buf, unsigned int len, void * dir_p);
int afp_read_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_readext_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_write_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_writeext_reply(struct afp_server *server, char * buf, unsigned int size, void * other);
int afp_byterangelock_reply(struct afp_server *server, char * buf, unsigned int size, void * x);
int afp_byterangelockext_reply(struct afp_server *server, char * buf, unsigned int size, void * x);
int afp_listextattrs_reply(struct afp_server *server, char * buf, unsigned int size, void * x);
#endif

380
lib/afp_url.c Normal file
View File

@ -0,0 +1,380 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "afpfs-ng/afp.h"
void afp_default_url(struct afp_url *url)
{
memset(url,0,sizeof(*url));
url->protocol=TCPIP;
url->port=548;
}
static int check_servername (char * servername)
{
if (strchr(servername,'/')) return -1;
return 0;
}
static int check_port(char * port)
{
long long ret = 0;
errno = 0;
ret = strtol(port,NULL,10);
if ((ret<0) || (ret>32767)) return -1;
if (errno) {
printf("port error\n");
return -1;
}
return 0;
}
static int check_uamname(const char * uam)
{
char * p;
for (p=(char *)uam;*p;p++) {
if (*p==' ') continue;
if ((*p<'A') || (*p>'z')) return -1;
}
return 0;
}
static int check_username(const char * user)
{
return 0;
}
static int check_password(const char * pass)
{
return 0;
}
static void escape_string(char * string, char c)
{
int i; char d;
int inescape=0;
char tmpstring[1024];
char * p = tmpstring;
memset(tmpstring,0,1024);
for (i=0;i<strlen(string);i++) {
d=string[i]; /* convenience */
if ((inescape) && (d==c)){
inescape=0;
continue;
}
*p=d;
p++;
if (d==c) inescape=1;
}
strcpy(string,tmpstring);
}
static void escape_url(struct afp_url * url)
{
escape_string(url->password,'@');
escape_string(url->username,':');
}
void afp_print_url(struct afp_url * url)
{
printf("servername: %s\n"
"volumename: %s\n"
"path: %s\n"
"username: %s\n"
"password: %s\n"
"port: %d\n"
"uam name: %s\n",
url->servername,
url->volumename,
url->path,
url->username,
url->password,
url->port,url->uamname);
}
static char * escape_strrchr(const char * haystack, int c, const char *toescape)
{
char * p;
if (strchr(toescape,c)==NULL)
return strrchr(haystack,c);
if ((p=strrchr(haystack,c))==NULL)
return NULL;
if (p==haystack)
return p;
if (*(p-1)!=c)
return p;
p-=2;
return escape_strrchr(p,c,toescape);
}
static char * escape_strchr(const char * haystack, int c, const char * toescape)
{
char * p;
if (strchr(toescape,c)==NULL)
return strchr(haystack,c);
if ((p=strchr(haystack,c))==NULL)
return NULL;
if (p-haystack==strlen(haystack))
return p;
if (*(p+1)!=c)
return p;
p+=2;
return escape_strchr(p,c,toescape);
}
int afp_parse_url(struct afp_url * url, const char * toparse, int verbose)
{
char firstpart[255],secondpart[2048];
char *p, *q;
int firstpartlen;
int skip_earliestpart=0;
int skip_secondpart=0;
char * lastchar;
int foundv6literal=0;
if (verbose) printf("Parsing %s\n",toparse);
url->username[0]='\0';
url->servername[0]='\0';
url->uamname[0]='\0';
url->password[0]='\0';
url->volumename[0]='\0';
url->path[0]='\0';
/* The most complex URL is:
afp://user;AUTH=authType:password@server-name:port/volume-name/path
where the optional parms are user, password, AUTH and port, so the
simplest is:
afp://server-name/volume-name/path
*/
/* if there is a ://, make sure it is preceeded by afp */
if ((p=strstr(toparse,"://"))!=NULL) {
q=p-3;
if (p<toparse) {
if (verbose) printf("URL does not start with afp://\n");
return -1;
}
if (strncmp(q,"afp",3)!=0) {
if (verbose) printf("URL does not start with afp://\n");
return -1;
}
p+=3;
} else {
if (verbose) printf("This isn't a URL at all.\n");
return -1;
}
if (p==NULL) p=(char *)toparse;
/* Now split on the first / */
if (sscanf(p,"%[^/]/%[^$]",
firstpart, secondpart)!=2) {
/* Okay, so there's no volume. */
skip_secondpart=1;
}
firstpartlen=strlen(firstpart);
lastchar=firstpart+firstpartlen-1;
/* First part could be something like:
user;AUTH=authType:password
We'll assume that the breakout is:
user; optional user name
AUTH=authtype:
*/
/* Let's see if there's a ';'. q is the end of the username */
if ((p=escape_strchr(firstpart,'@',"@"))) {
*p='\0';
p++;
} else {
skip_earliestpart=1;
p=firstpart;
}
/* p now points to the start of the server name*/
/* square brackets denote a literal ipv6 address */
if (*p == '[' &&
(q=strchr(p,']'))) {
foundv6literal = 1;
p++;
*q = '\0';
q++;
}
/* see if we have a port number */
if ((foundv6literal && (q=strchr(q,':'))) ||
(!foundv6literal && (q=strchr(p,':'))) ) {
*q='\0';
q++;
if (check_port(q)) return -1;
if ((url->port=atoi(q))==0) {
if (verbose) printf("Port appears to be zero\n");
return -1;
}
}
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;
}
if ((p==NULL) || ((strlen(p)+p-1)==lastchar)) {
/* afp://server */
}
if ((q) && ((strlen(q)+q-1)==lastchar)) {
/* afp://server:port */
}
/* Earliest part */
if (skip_earliestpart) {
p+=strlen(p);
goto parse_secondpart;
}
p=firstpart;
/* Now we're left with something like user[;AUTH=uamname][:password] */
/* Look for :password */
if ((q=escape_strrchr(p,':',":"))) {
*q='\0';
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;
}
}
/* Now we're down to user[;AUTH=uamname] */
p=firstpart;
if ((q=strstr(p,";AUTH="))) {
*q='\0';
q+=6;
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;
}
}
if (strlen(p)>0) {
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;;
}
}
parse_secondpart:
if (skip_secondpart) goto done;
if (strlen(secondpart)==0) goto done;
if (secondpart[strlen(secondpart)]=='/')
secondpart[strlen(secondpart)]='\0';
p=secondpart;
if ((q=strchr(p,'/'))) {
*q='\0';
q++;
}
snprintf(url->volumename,strlen(p)+1,"%s", p);
if (q) {
url->path[0]='/';
snprintf(url->path+1,strlen(q)+1, "%s", q);
}
done:
escape_url(url);
if (verbose) printf("Successful parsing of URL\n");
return 0;
}
int afp_url_validate(char * url_string, struct afp_url * valid_url)
{
struct afp_url new_url;
if (afp_parse_url(&new_url, url_string,0)) {
printf("url doesn't parse\n");
goto error;
}
#if BROKEN
if (new_url.protocol!=valid_url->protocol) {
printf("protocol doesn't match, I got %d when I expected %d\n",
new_url.protocol,valid_url->protocol);
goto error;
}
#endif
if (strcmp(new_url.username, valid_url->username)!=0) {
printf("username doesn't match, I got %s when I should have received %s\n",new_url.username, valid_url->username);
goto error;
}
if (strcmp(new_url.uamname, valid_url->uamname)!=0) {
printf("uamname doesn't match, I got %s when I should have received %s\n",new_url.uamname, valid_url->uamname);
goto error;
}
if (strcmp(new_url.password, valid_url->password)!=0) {
printf("password doesn't match, I got %s when I should have received %s\n",new_url.password, valid_url->password);
goto error;
}
if (strcmp(new_url.servername, valid_url->servername)!=0) {
printf("servername doesn't match, I got %s when I should have received %s\n",new_url.servername, valid_url->servername);
goto error;
}
if (strcmp(new_url.volumename, valid_url->volumename)!=0) {
printf("volumename doesn't match, I got %s when I should have received %s\n",new_url.volumename, valid_url->volumename);
goto error;
}
return 0;
error:
return -1;
}

23
lib/client.c Normal file
View File

@ -0,0 +1,23 @@
#include <afpfs-ng/afp.h>
#include <afpfs-ng/libafpclient.h>
struct libafpclient * libafpclient = NULL;
static struct libafpclient null_afpclient = {
.unmount_volume = NULL,
.log_for_client = stdout_log_for_client,
.forced_ending_hook = NULL,
.scan_extra_fds = NULL,
.loop_started = NULL,
};
void libafpclient_register(struct libafpclient * tmpclient)
{
if (tmpclient)
libafpclient=tmpclient;
else
libafpclient=&null_afpclient;
}

173
lib/codepage.c Normal file
View File

@ -0,0 +1,173 @@
/*
* codepage.c
*
* Copyright (C) 2007 Alex deVries
*
* These routines handle code page conversions.
*
* Currenly, only UTF8 is supported, but the structure should allow
* for classic code pages to be added.
*
*/
#include <string.h>
#include <stdlib.h>
#include "afpfs-ng/afp_protocol.h"
#include "afpfs-ng/utils.h"
#include "unicode.h"
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
char * dest, int dest_len);
int convert_utf8pre_to_utf8dec(const char * src, int src_len,
char * dest, int dest_len);
/*
* convert_path_to_unix()
*
* This converts an AFP-generated path to Unix's UTF8. This function
* does the appropriate encoding lookup.
*/
int convert_path_to_unix(char encoding, char * dest,
char * src, int dest_len)
{
memset(dest,0,dest_len);
switch (encoding) {
case kFPUTF8Name:
convert_utf8dec_to_utf8pre(src, strlen(src), dest, dest_len);
break;
case kFPLongName:
memcpy(dest,src,dest_len);
break;
/* This is where you would put support for other codepages. */
default:
return -1;
}
return 0;
}
/*
* convert_path_to_afp()
*
* Given a null terminated source, converts the path to an AFP path
* given the encoding.
*/
int convert_path_to_afp(char encoding, char * dest,
char * src, int dest_len)
{
memset(dest,0,dest_len);
switch (encoding) {
case kFPUTF8Name:
convert_utf8pre_to_utf8dec(src, strlen(src), dest,dest_len);
break;
case kFPLongName:
memcpy(dest,src,dest_len);
break;
/* This is where you would put support for other codepages. */
default:
return -1;
}
return 0;
}
/* convert_utf8dec_to_utf8pre()
*
* Conversion for text from Decomposed UTF8 used in AFP to Precomposed
* UTF8 used elsewhere.
*
*/
/* This is for converting *from* UTF-8-MAC */
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
char * dest, int dest_len)
{
char16 *path16dec, c, prev, *p16dec, *p16pre;
char16 path16pre[384]; // max 127 * 3 byte UTF8 characters
char *pathUTF8pre, *p8pre;
int comp;
path16dec = UTF8toUCS2(src);
p16dec = path16dec;
p16pre = path16pre;
prev = 0;
while(*p16dec > 0) {
c = *p16dec;
if(prev > 0) {
comp = UCS2precompose(prev, c);
if(comp != -1) {
prev = (char16)comp; // Keep and try to combine again on next loop
}
else {
*p16pre = prev;
prev = c;
p16pre++;
}
}
else {
prev = c;
}
p16dec++;
if(*p16dec == 0) { // End of string?
*p16pre = prev; // Add last char
p16pre++;
}
}
*p16pre = 0; // Terminate string
pathUTF8pre = UCS2toUTF8(path16pre);
p8pre = pathUTF8pre;
while(*p8pre) { // Copy precomposed UTF8 string to dest
*dest = *p8pre;
dest++;
p8pre++;
}
*dest = 0;
if(path16dec)
free(path16dec);
if(pathUTF8pre)
free(pathUTF8pre);
return 0;
}
/* convert_utf8pre_to_utf8dec()
*
* Conversion for text from Precomposed UTF8 to Decomposed UTF8.
*
* This is a sample conversion. The only translation it does is on one
* sequence of characters (0xc3 0xa4 becomes 0x61 0xcc 0x88).
*
* Fix this.
*/
int convert_utf8pre_to_utf8dec(const char * src, int src_len,
char * dest, int dest_len)
{
int i, j=0;
for (i=0;i<src_len && j < dest_len; i++) {
if (((src[i] & 0xff)==0xc3) && ((src[i+1] & 0xff)==0xa4)) {
dest[j]=0x61;
j++;
dest[j]=0xcc;
j++;
dest[j]=0x88;
i++;
} else
dest[j]=src[i];
j++;
}
return j;
}

146
lib/connect.c Normal file
View File

@ -0,0 +1,146 @@
/*
* connect.c
*
* Copyright (C) 2007 Alex deVries
*
*/
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include "afpfs-ng/afp.h"
#include "afpfs-ng/dsi.h"
#include "afpfs-ng/utils.h"
#include "afpfs-ng/uams_def.h"
#include "afpfs-ng/codepage.h"
#include "users.h"
#include "afpfs-ng/libafpclient.h"
#include "server.h"
struct addrinfo * afp_get_address(void * priv, const char * hostname, unsigned int port)
{
char port_string[6];
struct addrinfo hints;
struct addrinfo * addresses;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf(port_string, sizeof(port_string), "%u", port);
int res = getaddrinfo(hostname, port_string, &hints, &addresses);
if (res != 0 ) {
log_for_client(priv,AFPFSD,LOG_ERR,
"Could not resolve %s.\n",hostname);
return NULL;
}
return addresses;
}
struct afp_server * afp_server_full_connect (void * priv, struct afp_connection_request *req)
{
int ret;
struct addrinfo * address;
struct afp_server * s=NULL;
struct afp_server * tmpserver;
char signature[AFP_SIGNATURE_LEN];
unsigned char versions[SERVER_MAX_VERSIONS];
unsigned int uams;
char machine_type[AFP_MACHINETYPE_LEN];
char server_name[AFP_SERVER_NAME_LEN];
char server_name_utf8[AFP_SERVER_NAME_UTF8_LEN];
char server_name_printable[AFP_SERVER_NAME_UTF8_LEN];
unsigned int rx_quantum;
char icon[AFP_SERVER_ICON_LEN];
if ((address = afp_get_address(priv,req->url.servername, req->url.port)) == NULL)
goto error;
if ((s=find_server_by_address(address))) goto have_server;
if ((tmpserver=afp_server_init(address))==NULL) goto error;
if ((ret=afp_server_connect(tmpserver,1))<0) {
if (ret==-ETIMEDOUT) {
log_for_client(priv,AFPFSD,LOG_ERR,
"Could not connect, never got a response to getstatus, %s\n",strerror(-ret));
} else {
log_for_client(priv,AFPFSD,LOG_ERR,
"Could not connect, %s\n",strerror(-ret));
}
afp_server_remove(tmpserver);
goto error;
}
loop_disconnect(tmpserver);
memcpy(icon,&tmpserver->icon,AFP_SERVER_ICON_LEN);
memcpy(&versions,&tmpserver->versions,SERVER_MAX_VERSIONS);
uams=tmpserver->supported_uams;
memcpy(signature,&tmpserver->signature,AFP_SIGNATURE_LEN);
memcpy(machine_type,&tmpserver->machine_type,AFP_MACHINETYPE_LEN);
memcpy(server_name,&tmpserver->server_name,AFP_SERVER_NAME_LEN);
memcpy(server_name_utf8,&tmpserver->server_name_utf8,
AFP_SERVER_NAME_UTF8_LEN);
memcpy(server_name_printable,&tmpserver->server_name_printable,
AFP_SERVER_NAME_UTF8_LEN);
rx_quantum=tmpserver->rx_quantum;
afp_server_remove(tmpserver);
s=find_server_by_signature(signature);
if (!s) {
s = afp_server_init(address);
if (afp_server_connect(s,0) !=0) {
log_for_client(priv,AFPFSD,LOG_ERR,
"Could not connect to server error: %s\n",
strerror(errno));
goto error;
}
if ((afp_server_complete_connection(priv,
s,address,(unsigned char *) &versions,uams,
req->url.username, req->url.password,
req->url.requested_version, req->uam_mask))==NULL) {
goto error;
}
s->supported_uams=uams;
memcpy(s->signature,signature,AFP_SIGNATURE_LEN);
memcpy(s->server_name,server_name,AFP_SERVER_NAME_LEN);
memcpy(s->server_name_utf8,server_name_utf8,
AFP_SERVER_NAME_UTF8_LEN);
memcpy(s->server_name_printable,server_name_printable,
AFP_SERVER_NAME_UTF8_LEN);
memcpy(s->machine_type,machine_type,AFP_MACHINETYPE_LEN);
memcpy(s->icon,icon,AFP_SERVER_ICON_LEN);
s->rx_quantum=rx_quantum;
}
have_server:
/* Figure out if we're using netatalk */
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;
return s;
error:
if ((s) && (!something_is_mounted(s))) { /* FIXME */
afp_server_remove(s);
}
return NULL;
}

66
lib/debug.c Normal file
View File

@ -0,0 +1,66 @@
/* AFP function names */
static char * afp_command_names[] = {
"Zero", "afpByteRangeLock", "afpCloseVol", "afpCloseDir", "afpCloseFork",
"afpCopyFile", "afpCreateDir", "afpCreateFile", "afpDelete",
"afpEnumerate", "afpFlush", "afpFlushFork", "Unknown", /* 12 */
"Unknown", /* 13 */ "afpGetForkParms", "afpGetSrvrInfo", "afpGetSrvrParms",
"afpGetVolParms", "afpLogin", "afpLoginCont", "afpLogout",
"afpMapID", "afpMapName", "afpMoveAndRename", "afpOpenVol", "afpOpenDir",
"afpOpenFork", "afpRead", "afpRename", "afpSetDirParms", "afpSetFileParms",
"afpSetForkParms", "afpSetVolParms", "afpWrite", "afpGetFileDirParms",
"afpSetFileDirParms", "afpChangePassword", "afpGetUserInfo", "afpGetSrvrMsg", /* 38 */
"Unknown 39", "Unknown 40", "Unknown 41", "Unknown 42", "Unknown 43", "Unknown 44",
"Unknown 45", "Unknown 46", "Unknown 47", "afpOpenDT", "Unknown 49", "Unknown 50",
"afpGetIcon", "afpGetIconInfo", "Unknown 53", "Unknown 54", "Unknown 55", "afpAddComment",
"afpRemoveComment", "afpGetComment", "afpByteRangeLockExt", "afpReadExt", "afpWriteExt",
"afpGetAuthMethods", "afp_LoginExt", "afpGetSessionToken", "afpDisconnectOldSession",
"afpEnumerateExt", "afpCatSearchExt", "afpEnumerateExt2", "afpGetExtAttr",
"afpSetExtAttr", "afpRemoveExtAttr" , "afpListExtAttrs", /* 74 */
"Some AFP 3.2 undocumented feature",
"Unknown 76","Unknown 77","Unknown 78","Unknown 79","Unknown 80","Unknown 81",
"Unknown 82","Unknown 83","Unknown 84","Unknown 85","Unknown 86","Unknown 87",
"Unknown 88","Unknown 89","Unknown 90","Unknown 91","Unknown 92","Unknown 93",
"Unknown 94","Unknown 95","Unknown 96","Unknown 97","Unknown 98","Unknown 99",
"Unknown 100","Unknown 101","Unknown 102","Unknown 103","Unknown 104",
"Unknown 105","Unknown 106","Unknown 107","Unknown 108","Unknown 109",
"Unknown 110","Unknown 111","Unknown 112","Unknown 113","Unknown 114",
"Unknown 115","Unknown 116","Unknown 117","Unknown 118","Unknown 119",
"Unknown 120","Unknown 121", "afpZzzzz", /* 122 */
"Unknown 123","Unknown 124",
"Unknown 125","Unknown 126","Unknown 127","Unknown 128","Unknown 129",
"Unknown 130","Unknown 131","Unknown 132","Unknown 133","Unknown 134",
"Unknown 135","Unknown 136","Unknown 137","Unknown 138","Unknown 139",
"Unknown 140","Unknown 141","Unknown 142","Unknown 143","Unknown 144",
"Unknown 145","Unknown 146","Unknown 147","Unknown 148","Unknown 149",
"Unknown 150","Unknown 151","Unknown 152","Unknown 153","Unknown 154",
"Unknown 155","Unknown 156","Unknown 157","Unknown 158","Unknown 159",
"Unknown 160","Unknown 161","Unknown 162","Unknown 163","Unknown 164",
"Unknown 165","Unknown 166","Unknown 167","Unknown 168","Unknown 169",
"Unknown 170","Unknown 171","Unknown 172","Unknown 173","Unknown 174",
"Unknown 175","Unknown 176","Unknown 177","Unknown 178","Unknown 179",
"Unknown 180","Unknown 181","Unknown 182","Unknown 183","Unknown 184",
"Unknown 185","Unknown 186","Unknown 187","Unknown 188","Unknown 189",
"Unknown 190","Unknown 191", "afpAddIcon", "Unknown 193","Unknown 194",
"Unknown 195","Unknown 196","Unknown 197","Unknown 198","Unknown 199",
"Unknown 200","Unknown 201","Unknown 202","Unknown 203","Unknown 204",
"Unknown 205","Unknown 206","Unknown 207","Unknown 208","Unknown 209",
"Unknown 210","Unknown 211","Unknown 212","Unknown 213","Unknown 214",
"Unknown 215","Unknown 216","Unknown 217","Unknown 218","Unknown 219",
"Unknown 220","Unknown 221","Unknown 222","Unknown 223","Unknown 224",
"Unknown 225","Unknown 226","Unknown 227","Unknown 228","Unknown 229",
"Unknown 230","Unknown 231","Unknown 232","Unknown 233","Unknown 234",
"Unknown 235","Unknown 236","Unknown 237","Unknown 238","Unknown 239",
"Unknown 240","Unknown 241","Unknown 242","Unknown 243","Unknown 244",
"Unknown 245","Unknown 246","Unknown 247","Unknown 248","Unknown 249",
"Unknown 250","Unknown 251","Unknown 252","Unknown 253","Unknown 254",
"Unknown 255"
};
char * afp_get_command_name(char code)
{
return afp_command_names[code];
}

259
lib/did.c Normal file
View File

@ -0,0 +1,259 @@
/*
Copyright (C) 2006 Alex deVries <alexthepuffin@gmail.com>
*/
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>
#include <stdio.h>
#include "afpfs-ng/afp.h"
#include "afpfs-ng/afp_protocol.h"
#undef DID_CACHE_DISABLE
static unsigned short timeout=10;
struct did_cache_entry {
/* For the example /foo/bar/baz */
char dirname[AFP_MAX_PATH]; /* full name, eg. /foo/bar/ */
unsigned int did; /* eg 2323 */
struct timeval time;
struct did_cache_entry * next;
} ;
int free_entire_did_cache(struct afp_volume * volume)
{
struct did_cache_entry * d, * p, *p2;
pthread_mutex_lock(&volume->did_cache_mutex);
p=volume->did_cache_base;
for (d=volume->did_cache_base;d;d=p)
{
p2=p;
p=d->next;
free(p2);
}
pthread_mutex_unlock(&volume->did_cache_mutex);
return 0;
}
int remove_did_entry(struct afp_volume * volume, const char * name)
{
struct did_cache_entry * d, * p=NULL;
pthread_mutex_lock(&volume->did_cache_mutex);
for (d=volume->did_cache_base;d;d=d->next)
{
if (strcmp(d->dirname,name)==0) {
if (p)
p->next=d->next;
else
volume->did_cache_base=d->next;
volume->did_cache_stats.force_removed++;
free(d);
break;
} else
p=d;
}
pthread_mutex_unlock(&volume->did_cache_mutex);
return 0;
}
static int add_did_cache_entry(struct afp_volume * volume,
unsigned int new_did, char * path)
{
struct did_cache_entry * new, *old_base;
#ifdef DID_CACHE_DISABLE
return 0;
#endif
if ((new=malloc(sizeof(* new)))==NULL) return -1;
memset(new,0,sizeof(*new));
new->did=new_did;
memcpy(new->dirname,path,AFP_MAX_PATH);
gettimeofday(&new->time,NULL);
pthread_mutex_lock(&volume->did_cache_mutex);
old_base=volume->did_cache_base;
volume->did_cache_base=new;
new->next=old_base;
pthread_mutex_unlock(&volume->did_cache_mutex);
return 0;
}
unsigned char is_dir(struct afp_volume * volume,
unsigned int parentdid, const char * path)
{
int ret;
unsigned int filebitmap=0;
unsigned int dirbitmap=0;
struct afp_file_info fi;
#if 0
struct did_cache_entry * p;
if ((p=find_did_cache_entry(volume,parentdid,path,strlen(path))))
return p->isdir;
#endif
ret =afp_getfiledirparms(volume,parentdid,
filebitmap,dirbitmap,path,&fi);
if (ret) return 0;
return fi.isdir;
}
static unsigned int find_dirid_by_fullname(struct afp_volume * volume,
char * path)
{
struct did_cache_entry * p, *prev=volume->did_cache_base;
struct timeval time;
unsigned int found_did=0;
unsigned char breakearly=0;
#ifdef DID_CACHE_DISABLE
goto out;
#endif
gettimeofday(&time,NULL);
pthread_mutex_lock(&volume->did_cache_mutex);
for (p=volume->did_cache_base;p;p=p->next) {
if (time.tv_sec > (p->time.tv_sec+timeout)) {
volume->did_cache_stats.expired++;
if (prev==volume->did_cache_base) {
if (strcmp(p->dirname,path)==0) breakearly=1;
volume->did_cache_base=p->next;
free(p);
if (breakearly) goto out;
p=volume->did_cache_base;
if (!p) goto out;
prev=volume->did_cache_base;
continue;
} else {
prev->next=p->next;
free(p);
p=prev;
}
}
if (strcmp(p->dirname,path)==0) {
found_did=p->did;
volume->did_cache_stats.hits++;
goto out;
}
prev=p;
}
out:
pthread_mutex_unlock(&volume->did_cache_mutex);
return found_did;
}
/* This calculates the dirid and basename. It *always* gets the parent did. */
int get_dirid(struct afp_volume * volume, const char * path,
char * basename, unsigned int * dirid)
{
char * p, *p2;
int ret;
struct afp_file_info fi;
unsigned int filebitmap,dirbitmap;
unsigned int newdid;
unsigned int parent_did;
char copy[AFP_MAX_PATH];
if (((p=strrchr(path,'/')))==NULL) return -1;
/* Calculate the basename, leave copy with just the parent */
if (basename) {
memset(basename,0,AFP_MAX_PATH);
memcpy(basename,p+1,strlen(path)-(p-path)-1);
}
/* p now points to the last '/' */
if (p-path==0) {
*dirid=AFP_ROOT_DID;
goto out;
}
memcpy(copy,path,p-path+1);
if (copy[p-path]=='/') copy[p-path]='\0'; /* Lop off the last '/' */
/* See if the parent's fullname is in the cache */
if ((newdid=find_dirid_by_fullname(volume,copy))) {
*dirid=newdid;
goto out;
}
/* No? Work your way back to the start from the end looking
for a parent */
while ((p=strrchr(copy,'/'))) {
if (p==copy) {
/* Okay, we're done since we're at the start*/
parent_did=AFP_ROOT_DID;
break;
}
*p='\0';
if ((parent_did=find_dirid_by_fullname(volume,copy))) {
break;
}
}
/* Okay, now we have the topmost cached parent */
/* Move forward now from the last parentid */
filebitmap=kFPNodeIDBit ;
dirbitmap=kFPNodeIDBit ;
/* Go to the end of last known entry */
p=(char *)path+(p-copy);
p2=p;
while ((p=strchr(p+1,'/'))) {
memset(copy,0,AFP_MAX_PATH);
memcpy(copy,p2,p-p2);
volume->did_cache_stats.misses++;
ret =afp_getfiledirparms(volume,parent_did,
filebitmap,dirbitmap,copy,&fi);
if (fi.isdir) {
/* Add it to the cache */
memset(copy,0,AFP_MAX_PATH);
memcpy(copy,path,p-path);
add_did_cache_entry(volume, fi.fileid,copy);
} else {
break;
}
parent_did=fi.fileid;
p2=p;
}
*dirid=parent_did;
out:
return 0;
}

11
lib/did.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef __DID_H_
#define __DID_H_
int free_entire_did_cache(struct afp_volume * volume) ;
int remove_did_entry(struct afp_volume * volume, const char * name) ;
unsigned char is_dir(struct afp_volume * volume,
unsigned int parentdid, const char * path);
int get_dirid(struct afp_volume * volume, const char * path,
char * basename, unsigned int * dirid);
#endif

895
lib/dsi.c Normal file
View File

@ -0,0 +1,895 @@
/*
* dsi.c
*
* Copyright (C) 2006 Alex deVries
*
*/
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <errno.h>
#include <signal.h>
#include <iconv.h>
#include "afpfs-ng/utils.h"
#include "afpfs-ng/dsi.h"
#include "afpfs-ng/afp.h"
#include "afpfs-ng/uams_def.h"
#include "dsi_protocol.h"
#include "afpfs-ng/libafpclient.h"
#include "afp_internal.h"
#include "afp_replies.h"
/* define this in order to get reams of DSI debugging information */
#undef DEBUG_DSI
static int dsi_remove_from_request_queue(struct afp_server *server,
struct dsi_request *toremove);
int convert_utf8dec_to_utf8pre(const char *src, int src_len,
char * dest, int dest_len);
int convert_utf8pre_to_utf8dec(const char * src, int src_len,
char * dest, int dest_len);
/* This sets up a DSI header. */
void dsi_setup_header(struct afp_server * server, struct dsi_header * header, char command)
{
memset(header,0, sizeof(struct dsi_header));
pthread_mutex_lock(&server->requestid_mutex);
if (server->lastrequestid == 65535) server->lastrequestid = 0;
else server->lastrequestid++;
server->expectedrequestid = server->lastrequestid;
pthread_mutex_unlock(&server->requestid_mutex);
header->requestid = htons(server->lastrequestid);
header->command = command;
}
int dsi_getstatus(struct afp_server * server)
{
#define GETSTATUS_BUF_SIZE 1024
struct dsi_header header;
struct afp_rx_buffer rx;
int ret;
rx.data=malloc(GETSTATUS_BUF_SIZE);
rx.maxsize=GETSTATUS_BUF_SIZE;
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),60,
0,(void *) &rx);
free(rx.data);
return ret;
}
int dsi_sendtickle(struct afp_server *server)
{
struct dsi_header header;
dsi_setup_header(server,&header,DSI_DSITickle);
dsi_send(server,(char *) &header,sizeof(struct dsi_header),1,
DSI_DONT_WAIT,NULL);
return 0;
}
int dsi_opensession(struct afp_server *server)
{
struct {
struct dsi_header dsi_header __attribute__((__packed__));
uint8_t flags;
uint8_t length;
uint32_t rx_quantum ;
} __attribute__((__packed__)) dsi_opensession_header;
dsi_setup_header(server,&dsi_opensession_header.dsi_header,DSI_DSIOpenSession);
/* Advertize our rx quantum */
dsi_opensession_header.flags=1;
dsi_opensession_header.length=sizeof(unsigned int);
dsi_opensession_header.rx_quantum=htonl(server->attention_quantum);
dsi_send(server,(char *) &dsi_opensession_header,
sizeof(dsi_opensession_header),1,DSI_BLOCK_TIMEOUT,NULL);
return 0;
}
/*
static int check_incoming_dsi_message(struct afp_server * server, void * data, int size)
{
struct dsi_header * header = (struct dsi_header *) data;
if (size > sizeof(struct dsi_header)) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"DSI packet too small");
return -1;
}
if (header->flags != DSI_REPLY) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Got a non-DSI reply");
return -1;
}
if (header->requestid < server->lastrequestid ) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Got a requestid that was too low");
return -1;
}
if (header->requestid > server->lastrequestid ) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Got a requestid that was too high");
return -1;
}
return 0;
}
*/
static int dsi_remove_from_request_queue(struct afp_server *server,
struct dsi_request *toremove)
{
struct dsi_request *p, *prev=NULL;
#ifdef DEBUG_DSI
printf("*** removing %d, %s\n",toremove->requestid,
afp_get_command_name(toremove->subcommand));
#endif
if (!server_still_valid(server)) return -1;
pthread_mutex_lock(&server->request_queue_mutex);
for (p=server->command_requests;p;p=p->next) {
if (p==toremove) {
if (prev==NULL)
server->command_requests=p->next;
else
prev->next = p->next;
server->stats.requests_pending--;
free(p);
pthread_mutex_unlock(&server->request_queue_mutex);
return 0;
}
prev=p;
}
pthread_mutex_unlock(&server->request_queue_mutex);
#ifdef DEBUG_DSI
printf("*** Never removed anything for %d, %s\n",toremove->requestid,
afp_get_command_name(toremove->subcommand));
#endif
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Got an unknown reply for requestid %i\n",ntohs(toremove->requestid));
return -1;
}
int dsi_send(struct afp_server *server, char * msg, int size,int wait,unsigned char subcommand, void ** other)
{
/* For wait:
* -1: wait forever
* 0: don't wait
* x>n: wait for N seconds */
struct dsi_header *header = (struct dsi_header *) msg;
struct dsi_request * new_request, *p;
int rc=0;
struct timespec ts;
struct timeval tv;
header->length=htonl(size-sizeof(struct dsi_header));
if (!server_still_valid(server) || server->fd==0)
return -1;
afp_wait_for_started_loop();
/* Add request to the queue */
if (!(new_request=malloc(sizeof(struct dsi_request)))) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"Could not allocate for new request\n");
return -1;
}
memset(new_request,0,sizeof(struct dsi_request));
new_request->requestid=server->lastrequestid;
new_request->subcommand=subcommand;
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) {
server->command_requests=new_request;
} else {
for (p=server->command_requests;p->next;p=p->next);
p->next=new_request;
}
server->stats.requests_pending++;
pthread_mutex_unlock(&server->request_queue_mutex);
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];
unsigned int l=0;
/* Try and reconnect */
afp_server_reconnect(server,mesg,&l,1024);
}
pthread_mutex_lock(&server->send_mutex);
#ifdef DEBUG_DSI
printf("*** Sending %d, %s\n",ntohs(header->requestid),
afp_get_command_name(new_request->subcommand));
#endif
if (write(server->fd,msg,size)<0) {
if ((errno==EPIPE) || (errno==EBADF)) {
/* The server has closed the connection */
server->connect_state=SERVER_STATE_DISCONNECTED;
return -1;
}
perror("writing to server");
rc=-1;
pthread_mutex_unlock(&server->send_mutex);
goto out;
}
server->stats.tx_bytes+=size;
pthread_mutex_unlock(&server->send_mutex);
#ifdef DEBUG_DSI
printf("=== Waiting for response for %d %s\n",
new_request->requestid,
afp_get_command_name(new_request->subcommand));
#endif
if (new_request->wait<0) {
/* Wait forever */
#ifdef DEBUG_DSI
printf("=== Waiting forever for %d, %s\n",
new_request->requestid,
afp_get_command_name(new_request->subcommand));
#endif
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",
new_request->requestid,
afp_get_command_name(new_request->subcommand),
new_request->wait);
#endif
gettimeofday(&tv,NULL);
ts.tv_sec=tv.tv_sec;
ts.tv_sec+=new_request->wait;
ts.tv_nsec=tv.tv_usec *1000;
if (new_request->wait==0) {
#ifdef DEBUG_DSI
printf("=== Changing my mind, no longer waiting for %d\n",
new_request->requestid);
#endif
goto skip;
}
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
printf("=== Timedout for %d\n",
new_request->requestid);
#endif
goto out;
}
} else {
/* Don't wait */
#ifdef DEBUG_DSI
printf("=== Skipping wait altogether for %d\n",new_request->requestid);
#endif
}
#ifdef DEBUG_DSI
printf("=== Done waiting for %d %s, waiting for %ds,"
" return %d, DSI return %d\n",
new_request->requestid,
afp_get_command_name(new_request->subcommand),
new_request->wait,
rc,new_request->return_code);
#endif
skip:
rc=new_request->return_code;
out:
dsi_remove_from_request_queue(server,new_request);
return rc;
}
int dsi_command_reply(struct afp_server* server,unsigned short subcommand, void * other) {
int ret = 0;
if (server->data_read<sizeof(struct dsi_header)) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Got a short reply command, I am just ignoring it. size: %d\n",server->data_read);
return -1;
}
if (subcommand==0) {
log_for_client(NULL,AFPFSD,LOG_WARNING,
"Broken subcommand: %d\n",subcommand);
return -1;
}
if ((subcommand==afpRead) || ( subcommand==afpReadExt)) {
struct afp_rx_buffer * buf = other;
#ifdef DEBUG_DSI
printf("=== read() for afpRead, %d bytes\n",buf->maxsize-buf->size);
#endif
if ((ret=read(server->fd,buf->data+buf->size,
buf->maxsize-buf->size))<0) {
return -1;
}
server->stats.rx_bytes+=ret;
if (ret==0) {
return -1;
}
server->data_read+=ret;
}
ret = afp_reply(subcommand,server,other);
return ret;
}
void dsi_opensession_reply(struct afp_server * server) {
struct {
uint8_t flags ;
uint8_t length ;
uint32_t tx_quantum;
} __attribute__((__packed__)) * dsi_opensession_header = (void *)
server->incoming_buffer + sizeof(struct dsi_header);
server->tx_quantum = ntohl(dsi_opensession_header->tx_quantum);
}
static int dsi_parse_versions(struct afp_server * server, char * msg)
{
unsigned char num_versions = msg[0];
int i,j=0;
char * p;
unsigned char len;
char tmpversionname[33];
struct afp_versions * tmpversion;
memset(server->versions,0, SERVER_MAX_VERSIONS);
if (num_versions > SERVER_MAX_VERSIONS) num_versions = SERVER_MAX_VERSIONS;
p=msg+1;
for (i=0;i<num_versions;i++) {
len=copy_from_pascal(tmpversionname,p,33)+1;
for (tmpversion=afp_versions;tmpversion->av_name;tmpversion++) {
if (strcmp(tmpversion->av_name,tmpversionname)==0) {
server->versions[j]=tmpversion->av_number;
j++;
break;
}
}
p+=len;
}
return 0;
}
static int dsi_parse_uams(struct afp_server * server, char * msg)
{
unsigned char num_uams = msg[0];
unsigned char len;
int i;
char * p;
char ua_name[AFP_UAM_LENGTH+1];
server->supported_uams= 0;
memset(ua_name,0,AFP_UAM_LENGTH+1);
if (num_uams > SERVER_MAX_UAMS) num_uams = SERVER_MAX_UAMS;
p=msg+1;
for (i=0;i<num_uams;i++) {
len=copy_from_pascal(ua_name,p,AFP_UAM_LENGTH)+1;
server->supported_uams|=uam_string_to_bitmap(ua_name);
p+=len;
}
return 0;
}
/* The parsing of the return for DSI GetStatus is the same as for
* AFP GetSrvrInfo (which we don't yet support) */
void dsi_getstatus_reply(struct afp_server * server)
{
/* Todo: check for buffer overruns */
char * data, *p, *p2;
int len;
uint16_t * offset;
/* This is the fixed portion */
struct dsi_getstatus_header {
struct dsi_header dsi __attribute__((__packed__));
uint16_t machine_offset;
uint16_t version_offset;
uint16_t uams_offset;
uint16_t icon_offset;
uint16_t flags ;
} __attribute__((__packed__)) * reply1 = (void *) server->incoming_buffer;
struct reply2 {
uint16_t signature_offset;
uint16_t networkaddress_offset;
uint16_t directoryservices_offset;
uint16_t utf8servername_offset;
} __attribute__((__packed__)) * reply2;
if (server->data_read < (sizeof(*reply1) + sizeof(*reply2))) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"Got incomplete data for getstatus\n");
return ;
}
data = (char * ) server->incoming_buffer + sizeof(struct dsi_header);
/* First, get the fixed portion */
p=data + ntohs(reply1->machine_offset);
copy_from_pascal(server->machine_type,p,AFP_MACHINETYPE_LEN);
p=data + ntohs(reply1->version_offset);
dsi_parse_versions(server, p);
p=data + ntohs(reply1->uams_offset);
dsi_parse_uams(server, p);
if (ntohs(reply1->icon_offset)>0) {
/* The icon and mask are optional */
p=data + ntohs(reply1->icon_offset);
memcpy(server->icon,p,256);
}
server->flags=ntohs(reply1->flags);
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 */
/* First, make sure we're on an even boundary */
if (((uintptr_t) p) & 0x1) p++;
/* Get the signature */
offset = (uint16_t *) p;
memcpy(server->signature,
((void *) data)+ntohs(*offset),
AFP_SIGNATURE_LEN);
p+=2;
/* The network addresses */
if (server->flags & kSupportsTCP) {
offset = (uint16_t *) p;
/* We don't actually do anything with the network addresses,
* but if we did, it'd go here */
p+=2;
}
/* The directory names */
if (server->flags & kSupportsDirServices) {
offset = (uint16_t *) p;
/* We don't actually do anything with the directory names,
* but if we did, it'd go here */
p+=2;
}
if (server->flags & kSupportsUTF8SrvrName) {
/* And now the UTF8 server name */
offset = (uint16_t *) p;
p2=((void *) data)+ntohs(*offset);
/* Skip the hint character */
p2+=1;
len=copy_from_pascal(server->server_name_utf8,p2,
AFP_SERVER_NAME_UTF8_LEN);
/* This is a workaround. There's a bug in netatalk that in some
* circumstances puts the UTF8 servername off by one character */
if (len==0) {
p2++;
len=copy_from_pascal(server->server_name_utf8,p2,
AFP_SERVER_NAME_UTF8_LEN);
}
convert_utf8dec_to_utf8pre(server->server_name_utf8,
strlen(server->server_name_utf8),
server->server_name_printable, AFP_SERVER_NAME_UTF8_LEN);
} else {
/* We don't have a UTF8 servername, so let's make one */
iconv_t cd;
size_t inbytesleft = strlen(server->server_name);
size_t outbytesleft = AFP_SERVER_NAME_UTF8_LEN;
char * inbuf = server->server_name;
char * outbuf = server->server_name_printable;
if ((cd = iconv_open("MACINTOSH","UTF-8")) == (iconv_t) -1)
return;
iconv(cd,&inbuf,&inbytesleft,
&outbuf, &outbytesleft);
iconv_close(cd);
}
}
void dsi_incoming_closesession(struct afp_server *server)
{
afp_unmount_all_volumes(server);
loop_disconnect(server);
}
void dsi_incoming_tickle(struct afp_server * server)
{
struct dsi_header header;
dsi_setup_header(server,&header,DSI_DSITickle);
dsi_send(server,(char *) &header,sizeof(struct dsi_header),0,
DSI_DONT_WAIT,NULL);
}
void * dsi_incoming_attention(void * other)
{
struct afp_server * server = other;
struct {
struct dsi_header header __attribute__((__packed__));
uint16_t flags ;
} __attribute__((__packed__)) *packet = (void *) server->attention_buffer;
unsigned short flags;
char mesg[AFP_LOGINMESG_LEN];
unsigned char shutdown=0;
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
the message if there is a flag and we have the AFPATTN_MESG flag.
Checked on netatalk 2.0.3. */
/* It's a bit tough to find docs on this, but I found it at:
http://web.archive.org/web/20010806173437/developer.apple.com/techpubs/macosx/Networking/AFPClient/AFPClient-15.html
*/
if (ntohl(packet->header.length)>=2) {
flags=ntohs(packet->flags);
if (flags&AFPATTN_MESG)
checkmessage=1;
if (flags&(AFPATTN_CRASH|AFPATTN_SHUTDOWN))
shutdown=1;
mins=flags & 0xff;
} else {
checkmessage=1;
}
if (checkmessage) {
afp_getsrvrmsg(server,AFPMESG_SERVER,
((server->using_version->av_number>=30)?1:0),
DSI_DEFAULT_TIMEOUT,mesg);
if(bcmp(mesg,"The server is going down for maintenance.",41)==0)
shutdown=1;
}
if (shutdown) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"Got a shutdown notice in packet %d, going down in %d mins\n",ntohs(packet->header.requestid),mins);
loop_disconnect(server);
server->connect_state=SERVER_STATE_DISCONNECTED;
return NULL;
}
return NULL;
}
struct dsi_request * dsi_find_request(struct afp_server *server,
unsigned short request_id)
{
struct dsi_request *p, *prev=NULL;
pthread_mutex_lock(&server->request_queue_mutex);
for (p=server->command_requests;p;p=p->next) {
if (request_id==p->requestid) {
pthread_mutex_unlock(&server->request_queue_mutex);
return p;
}
prev=p;
}
pthread_mutex_unlock(&server->request_queue_mutex);
return NULL;
}
int dsi_recv(struct afp_server * server)
{
struct dsi_header * header = (void *) server->incoming_buffer;
struct dsi_request * request=NULL;
int rc;
int amount_to_read=0;
int ret;
unsigned char runt_packet=0;
/* Make sure we have at least one header */
if ((amount_to_read=sizeof(struct dsi_header)-server->data_read)>0) {
#ifdef DEBUG_DSI
printf("<<< read() for dsi, %d bytes\n",amount_to_read);
#endif
ret = read(server->fd,server->incoming_buffer+server->data_read,
amount_to_read);
if (ret<0) {
perror("dsi_recv");
return -1;
}
if (ret==0) {
return -1;
}
server->stats.rx_bytes+=ret;
server->data_read+=ret;
if ((server->data_read==sizeof(struct dsi_header)) &&
(ntohl(header->length)==0)) {
goto gotenough;
}
return 0;
/* We'll get the rest of the packet next time */
}
gotenough:
/* At this point, we have just the header */
/* Figure out what it is a reply to */
request = dsi_find_request(server,ntohs(header->requestid));
if (!request && (header->flags==DSI_REPLY)) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"I have no idea what this is a reply to, id %d.\n",
ntohs(header->requestid));
runt_packet=1;
server->stats.runt_packets++;
}
if (request) request->return_code=ntohl(header->return_code.error_code);
/* If it is a read, read in as much as we can */
if ((request) &&
((request->subcommand==afpRead) ||
(request->subcommand==afpReadExt))) {
struct afp_rx_buffer * buf = request->other;
int newmax=buf->maxsize-buf->size;
if (((server->data_read==sizeof(struct dsi_header)) &&
(ntohl(header->length)==0))) {
server->data_read=0;
goto out;
}
if ((!buf) || (!buf->maxsize)) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"No buffer allocated for incoming data\n");
return -1;
}
if (newmax>ntohl(header->length)-buf->size)
newmax=ntohl(header->length)-buf->size;
#ifdef DEBUG_DSI
printf("<<< read() in response to a request, %d bytes\n",newmax);
#endif
ret = read(server->fd,buf->data+buf->size,
newmax);
if (ret<0) {
return -1;
}
if (ret==0) {
return -1;
}
server->stats.rx_bytes+=ret;
buf->size+=ret;
/* Check to see if we've read enough */
if (ntohl(header->length)==buf->size) {
char * tmpbuf;
int size_to_copy=server->data_read
-sizeof(struct dsi_header);
if (size_to_copy==0) {
server->data_read=0;
goto out;
} else if (size_to_copy<0) goto error;
/* Okay, so there is a buffer we have to shift */
if ((tmpbuf=malloc(size_to_copy))==NULL) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"Problem allocating memory for dsi_recv of size %d",size_to_copy);
goto error;
}
memcpy(tmpbuf,
server->incoming_buffer+
sizeof(struct dsi_header),
size_to_copy);
memcpy(server->incoming_buffer,tmpbuf,
size_to_copy);
server->data_read=size_to_copy;
free(tmpbuf);
} else return 0;
} else {
/* Okay, so it isn't a response to an afpRead or afpReadExt */
if (((server->data_read==sizeof(struct dsi_header)) &&
(ntohl(header->length)==0)))
goto process_packet;
amount_to_read=min(ntohl(header->length),server->bufsize);
#ifdef DEBUG_DSI
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),
amount_to_read);
if (ret<0) return -1;
if (ret==0) {
return -1;
}
server->stats.rx_bytes+=ret;
server->data_read+=ret;
if (server->data_read<(ntohl(header->length)+sizeof(*header)))
return 0;
}
if (runt_packet)
goto after_processing;
process_packet:
/* At this point, we have a full DSI packet
(or, for an afpRead, just the header and the data's been
dumped in the preallocated buffer */
#ifdef DEBUG_DSI
printf("<<< Handling %d\n",ntohs(header->requestid));
#endif
switch (header->command) {
case DSI_DSICloseSession:
dsi_incoming_closesession(server);
break;
case DSI_DSIGetStatus:
dsi_getstatus_reply(server);
break;
case DSI_DSIOpenSession:
dsi_opensession_reply(server);
break;
case DSI_DSITickle:
dsi_incoming_tickle(server);
break;
case DSI_DSIWrite:
case DSI_DSICommand:
if (!runt_packet)
dsi_command_reply(server, request->subcommand,request->other);
break;
case DSI_DSIAttention:
{
pthread_t thread;
memcpy( server->attention_buffer,
server->incoming_buffer,
server->data_read);
server->attention_len=server->data_read;
pthread_create(&thread,NULL,
dsi_incoming_attention,server);
}
break;
default:
log_for_client(NULL,AFPFSD,LOG_ERR,
"Unknown DSI command %i\n",header->command);
goto error;
}
after_processing:
if (server->data_read==ntohl(header->length)+sizeof(*header)) {
/* The most common case */
server->data_read=0;
} else {
unsigned int size_to_copy=
server->data_read-
(ntohl(header->length)+sizeof(*header));
char * tmpbuf;
if (size_to_copy<ntohl(header->length)) {
/* This could be replaced with memmove, as it handles
* overlaps */
memcpy( server->incoming_buffer,
server->incoming_buffer+ntohl(header->length),
size_to_copy);
} else {
/* This is more complicated, we need an tmp buf */
if ((tmpbuf=malloc(size_to_copy))==NULL) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"Problem allocating memory for dsi_recv of size %d",size_to_copy);
goto error;
}
memcpy(tmpbuf,
server->incoming_buffer+ntohl(header->length),
size_to_copy);
memcpy(server->incoming_buffer,tmpbuf,size_to_copy);
free(tmpbuf);
}
server->data_read-=size_to_copy;
}
out:
rc=ntohl(header->return_code.error_code);
if (request) {
#ifdef DEBUG_DSI
printf("<<< Found request %d, %s\n",request->requestid,
afp_get_command_name(request->subcommand));
#endif
if (request->wait) {
#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;
request->done_waiting=1;
pthread_cond_signal(&request->waiting_cond);
pthread_mutex_unlock(&request->waiting_mutex);
} else {
dsi_remove_from_request_queue(server,request);
}
}
return 0;
error:
#ifdef DEBUG_DSI
printf("returning from dsi_recv with an error\n");
#endif
return -1;
}

35
lib/dsi_protocol.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef __DSI_PROTOCOL_H_
#define __DSI_PROTOCOL_H_
/* These are DSI constants */
#define DSI_REQUEST 0x0
#define DSI_REPLY 0x1
#define DSI_DSICloseSession 1
#define DSI_DSICommand 2
#define DSI_DSIGetStatus 3
#define DSI_DSIOpenSession 4
#define DSI_DSITickle 5
#define DSI_DSIWrite 6
#define DSI_DSIAttention 8
struct dsi_header {
uint8_t flags;
uint8_t command;
uint16_t requestid;
union {
int error_code;
unsigned int data_offset;
} return_code;
uint32_t length;
uint32_t reserved;
};
void dsi_setup_header(struct afp_server * server, struct dsi_header * header, char command);
#endif

69
lib/forklist.c Normal file
View File

@ -0,0 +1,69 @@
/*
forklist.c: some functions which help record which forks were opened.
Copyright (C) 2008 Alex deVries <alexthepuffin@gmail.com>
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#include "afpfs-ng/afp.h"
#include <stdlib.h>
#include <pthread.h>
void add_opened_fork(struct afp_volume * volume, struct afp_file_info * fp)
{
pthread_mutex_lock(&volume->open_forks_mutex);
fp->largelist_next=volume->open_forks;
volume->open_forks=fp;
pthread_mutex_unlock(&volume->open_forks_mutex);
}
void remove_opened_fork(struct afp_volume * volume, struct afp_file_info * fp)
{
struct afp_file_info * p, * prev = NULL;
pthread_mutex_lock(&volume->open_forks_mutex);
for (p=volume->open_forks;p;p=p->largelist_next)
{
if (p==fp) {
if (prev)
prev->largelist_next=p->largelist_next;
else
volume->open_forks=p->largelist_next;
goto done;
}
prev=p;
}
done:
pthread_mutex_unlock(&volume->open_forks_mutex);
}
void remove_fork_list(struct afp_volume * volume)
{
struct afp_file_info * p, * next;
pthread_mutex_lock(&volume->open_forks_mutex);
for (p=volume->open_forks;p;p=next)
{
next=p->largelist_next;
afp_flushfork(volume,p->forkid);
afp_closefork(volume,p->forkid);
volume->open_forks=p->largelist_next;
free(p);
}
pthread_mutex_unlock(&volume->open_forks_mutex);
}

6
lib/forklist.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef __FORKLIST_H_
#define __FORKLIST_H_
void add_opened_fork(struct afp_volume * volume, struct afp_file_info * fp);
void remove_opened_fork(struct afp_volume * volume, struct afp_file_info * fp);
void remove_fork_list(struct afp_volume * volume);
#endif

26
lib/log.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "afpfs-ng/libafpclient.h"
void log_for_client(void * priv,
enum loglevels loglevel, int logtype, char *format, ...) {
va_list ap;
char new_message[1024];
va_start(ap, format);
vsnprintf(new_message,1024,format,ap);
va_end(ap);
libafpclient->log_for_client(priv,loglevel,logtype,new_message);
}
void stdout_log_for_client(void * priv,
enum loglevels loglevel, int logtype, const char *message)
{
printf("%s\n",message);
}

272
lib/loop.c Normal file
View File

@ -0,0 +1,272 @@
/*
* loop.c
*
* Copyright (C) 2007 Alex deVries
*
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <utime.h>
#include <stdlib.h>
#include <getopt.h>
#include <unistd.h>
#include <sys/time.h>
#include <signal.h>
#include "afpfs-ng/afp.h"
#include "afpfs-ng/dsi.h"
#include "afpfs-ng/utils.h"
#define SIGNAL_TO_USE SIGUSR2
static unsigned char exit_program=0;
static pthread_t ending_thread;
static pthread_t main_thread = (pthread_t)NULL;
static int loop_started=0;
static pthread_cond_t loop_started_condition;
static pthread_mutex_t loop_started_mutex;
void trigger_exit(void)
{
exit_program=1;
}
void termination_handler(int signum)
{
switch (signum) {
case SIGINT:
case SIGTERM:
trigger_exit();
break;
default:
break;
}
signal(SIGNAL_TO_USE, termination_handler);
}
#define max(a,b) (((a)>(b)) ? (a) : (b))
static fd_set rds;
static int max_fd=0;
static void add_fd(int fd)
{
FD_SET(fd,&rds);
if ((fd+1) > max_fd) max_fd=fd+1;
}
static void rm_fd(int fd)
{
int i;
FD_CLR(fd,&rds);
for (i=max_fd;i>=0;i--)
if (FD_ISSET(i,&rds)) {
max_fd=i;
break;
}
max_fd++;
}
void signal_main_thread(void)
{
if (main_thread)
pthread_kill(main_thread,SIGNAL_TO_USE);
}
static int ending=0;
void * just_end_it_now(void * ignore)
{
if (ending) return NULL;
ending=1;
if (libafpclient->forced_ending_hook)
libafpclient->forced_ending_hook();
exit_program=2;
signal_main_thread();
return NULL;
}
/*This is a hack to handle a problem where the first pthread_kill doesnt' work*/
static unsigned char firsttime=0;
void add_fd_and_signal(int fd)
{
add_fd(fd);
signal_main_thread();
if (!firsttime) {
firsttime=1;
signal_main_thread();
}
}
void rm_fd_and_signal(int fd)
{
rm_fd(fd);
signal_main_thread();
}
void loop_disconnect(struct afp_server *s)
{
if (s->connect_state!=SERVER_STATE_CONNECTED)
return;
rm_fd_and_signal(s->fd);
/* Handle disconnect */
close(s->fd);
s->connect_state=SERVER_STATE_DISCONNECTED;
s->need_resume=1;
}
static int process_server_fds(fd_set * set, int max_fd, int ** onfd)
{
struct afp_server * s;
int ret;
s = get_server_base();
for (;s;s=s->next) {
if (s->next==s) printf("Danger, recursive loop\n");
if (FD_ISSET(s->fd,set)) {
ret=dsi_recv(s);
*onfd=&s->fd;
if (ret==-1) {
loop_disconnect(s);
return -1;
}
return 1;
}
}
return 0;
}
static void deal_with_server_signals(fd_set *set, int * max_fd)
{
if (exit_program==1) {
pthread_create(&ending_thread,NULL,just_end_it_now,NULL);
}
}
void afp_wait_for_started_loop(void)
{
if (loop_started) return;
pthread_cond_wait(&loop_started_condition,&loop_started_mutex);
}
static void * afp_main_quick_startup_thread(void * other)
{
afp_main_loop(-1);
return NULL;
}
int afp_main_quick_startup(pthread_t * thread)
{
pthread_t loop_thread;
pthread_create(&loop_thread,NULL,afp_main_quick_startup_thread,NULL);
if (thread)
memcpy(thread,&loop_thread,sizeof(pthread_t));
return 0;
}
int afp_main_loop(int command_fd) {
fd_set ords, oeds;
struct timespec tv;
int ret;
int fderrors=0;
sigset_t sigmask, orig_sigmask;
main_thread=pthread_self();
FD_ZERO(&rds);
if (command_fd>=0)
add_fd(command_fd);
sigemptyset(&sigmask);
sigaddset(&sigmask,SIGNAL_TO_USE);
sigprocmask(SIG_BLOCK,&sigmask,&orig_sigmask);
signal(SIGNAL_TO_USE,termination_handler);
signal(SIGTERM,termination_handler);
signal(SIGINT,termination_handler);
while(1) {
ords=rds;
oeds=rds;
if (loop_started) {
tv.tv_sec=30;
tv.tv_nsec=0;
} else {
tv.tv_sec=0;
tv.tv_nsec=0;
}
ret=pselect(max_fd,&ords,NULL,&oeds,&tv,&orig_sigmask);
if (exit_program==2) break;
if (exit_program==1) {
pthread_create(&ending_thread,NULL,just_end_it_now,NULL);
}
if (ret<0) {
switch(errno) {
case EINTR:
deal_with_server_signals(&rds,&max_fd);
break;
case EBADF:
if (fderrors > 100) {
log_for_client(NULL,AFPFSD,LOG_ERR,
"Too many fd errors, exiting\n");
break;
}
fderrors++;
continue;
}
continue;
}
fderrors=0;
if (ret==0) {
/* Timeout */
if (loop_started==0) {
loop_started=1;
pthread_cond_signal(&loop_started_condition);
if (libafpclient->loop_started)
libafpclient->loop_started();
}
} else {
int * onfd;
fderrors=0;
switch (process_server_fds(&ords,max_fd,&onfd)) {
case -1:
continue;
case 1:
continue;
}
if (libafpclient->scan_extra_fds) {
if (libafpclient->scan_extra_fds(
command_fd,&ords,&max_fd)>0)
continue;
}
}
}
return -1;
}

692
lib/lowlevel.c Normal file
View File

@ -0,0 +1,692 @@
/*
lowlevel.c: some functions that abstract common operations; used
so the same code can be used between meta and normal files
Copyright (C) 2008 Alex deVries <alexthepuffin@gmail.com>
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#ifdef __linux__
#include <asm/fcntl.h>
#else
#include <fcntl.h>
#endif
#include "afpfs-ng/afp.h"
#include "afpfs-ng/afp_protocol.h"
#include "afpfs-ng/codepage.h"
#include "afpfs-ng/utils.h"
#include "afpfs-ng/midlevel.h"
#include "lib/forklist.h"
#include "did.h"
#include "users.h"
static void set_nonunix_perms(unsigned int * mode, struct afp_file_info *fp)
{
if (fp->isdir)
*mode = 0700 | S_IFDIR;
else
*mode = 0600 | S_IFREG;
}
int ll_handle_unlocking(struct afp_volume * volume,unsigned short forkid,
uint64_t offset, uint64_t sizetorequest)
{
uint64_t generated_offset;
int rc;
if (volume->extra_flags & VOLUME_EXTRA_FLAGS_NO_LOCKING)
return 0;
if (volume->server->using_version->av_number < 30)
rc=afp_byterangelock(volume,ByteRangeLock_Unlock,
forkid,offset, sizetorequest,
(uint32_t *) &generated_offset);
else
rc=afp_byterangelockext(volume,ByteRangeLock_Unlock,
forkid,offset, sizetorequest,&generated_offset);
switch(rc) {
case kFPNoErr:
break;
case kFPMiscErr:
case kFPParamErr:
case kFPRangeNotLocked:
default:
return -1;
}
return 0;
}
int ll_handle_locking(struct afp_volume * volume,unsigned short forkid,
uint64_t offset, uint64_t sizetorequest)
{
#define MAX_LOCKTRYCOUNT 10
int rc=0;
int try=0;
uint64_t generated_offset;
if (volume->extra_flags & VOLUME_EXTRA_FLAGS_NO_LOCKING)
return 0;
while (try<MAX_LOCKTRYCOUNT) {
try++;
if (volume->server->using_version->av_number < 30)
rc=afp_byterangelock(volume,ByteRangeLock_Lock,
forkid,offset, sizetorequest,
(uint32_t *) &generated_offset);
else
rc=afp_byterangelockext(volume,ByteRangeLock_Lock,
forkid,offset, sizetorequest,&generated_offset);
switch(rc) {
case kFPNoErr:
goto done;
case kFPNoMoreLocks: /* Max num of locks on server */
case kFPLockErr: /*Some or all of the requested range is locked
by another user. */
sleep(1);
break;
default:
return -1;
}
}
done:
return 0;
}
/* zero_file()
*
* This function will truncate the fork given to zero bytes in length.
* This has been abstracted because there is some differences in the
* expectation of Ext or not Ext. */
int ll_zero_file(struct afp_volume * volume, unsigned short forkid,
unsigned int resource)
{
unsigned int bitmap;
int ret;
/* The Airport Extreme 7.1.1 will crash if you send it
* DataForkLenBit. Netatalk replies with an error if you
* send it ExtDataForkLenBit. So we need to choose. */
if ((volume->server->using_version->av_number < 30) ||
(volume->server->server_type==AFPFS_SERVER_TYPE_NETATALK))
bitmap=(resource ?
kFPRsrcForkLenBit : kFPDataForkLenBit);
else
bitmap=(resource ?
kFPExtRsrcForkLenBit : kFPExtDataForkLenBit);
ret=afp_setforkparms(volume,forkid,bitmap,0);
switch (ret) {
case kFPAccessDenied:
ret=EACCES;
break;
case kFPVolLocked:
case kFPLockErr:
ret=EBUSY;
break;
case kFPDiskFull:
ret=ENOSPC;
break;
case kFPBitmapErr:
case kFPMiscErr:
case kFPParamErr:
ret=EIO;
break;
default:
ret=0;
}
return ret;
}
/* get_directory_entry is used to abstract afp_getfiledirparms
* * because in AFP<3.0 there is only afp_getfileparms and afp_getdirparms.
* */
int ll_get_directory_entry(struct afp_volume * volume,
char * basename,
unsigned int dirid,
unsigned int filebitmap, unsigned int dirbitmap,
struct afp_file_info *p)
{
int ret;
char tmpname[AFP_MAX_PATH];
memcpy(tmpname,p->basename,AFP_MAX_PATH);
ret =afp_getfiledirparms(volume,dirid,
filebitmap,dirbitmap,basename,p);
memcpy(p->basename,tmpname,AFP_MAX_PATH);
return ret;
}
int ll_open(struct afp_volume * volume, const char *path, int flags,
struct afp_file_info *fp)
{
/* FIXME: doesn't handle create properly */
int ret, dsi_ret,rc;
int create_file=0;
//char converted_path[AFP_MAX_PATH];
unsigned char aflags = AFP_OPENFORK_ALLOWREAD;
if (flags & O_RDONLY) aflags|=AFP_OPENFORK_ALLOWREAD;
if (flags & O_WRONLY) aflags|=AFP_OPENFORK_ALLOWWRITE;
if (flags & O_RDWR)
aflags |= (AFP_OPENFORK_ALLOWREAD | AFP_OPENFORK_ALLOWWRITE);
if ((aflags&AFP_OPENFORK_ALLOWWRITE) &
(volume_is_readonly(volume))) {
ret=EPERM;
goto error;
}
/*
O_NOBLOCK - todo: it is unclear how to this in fuse.
*/
/* The following flags don't need any attention here:
O_ASYNC - not relevant for files
O_APPEND
O_NOATIME - we have no way to handle this anyway
*/
/*this will be used later for caching*/
#ifdef __linux__
fp->sync=((unsigned char)(flags & (O_SYNC | O_DIRECT)));
#else
fp->sync=(flags & (O_SYNC));
#endif
/* See if we need to create the file */
if (aflags & AFP_OPENFORK_ALLOWWRITE) {
if (create_file) {
/* Create the file */
if (flags & O_EXCL) {
ret=EEXIST;
goto error;
}
rc=afp_createfile(volume,kFPSoftCreate,fp->did,fp->basename);
}
}
if (
#ifdef __linux__
(flags & O_LARGEFILE) &&
#endif
(volume->server->using_version->av_number<30))
{
switch(ll_get_directory_entry(volume,fp->basename,fp->did,
kFPParentDirIDBit|kFPNodeIDBit|
(fp->resource ? kFPRsrcForkLenBit : kFPDataForkLenBit),
0,fp)) {
case kFPAccessDenied:
ret=EACCES;
goto error;
case kFPObjectNotFound:
ret=ENOENT;
goto error;
case kFPNoErr:
break;
case kFPBitmapErr:
case kFPMiscErr:
case kFPParamErr:
default:
ret=EIO;
goto error;
}
if ((fp->resource ? (fp->resourcesize>=(AFP_MAX_AFP2_FILESIZE-1)) :
( fp->size>=AFP_MAX_AFP2_FILESIZE-1))) {
/* According to p.30, if the server doesn't support >4GB files
and the file being opened is >4GB, then resourcesize or size
will return 4GB. How can it return 4GB in 32 its? I
suspect it actually returns 4GB-1.
*/
ret=EOVERFLOW;
goto error;
}
}
try_again:
dsi_ret=afp_openfork(volume,fp->resource?1:0,fp->did,
aflags,fp->basename,fp);
switch (dsi_ret) {
case kFPAccessDenied:
ret=EACCES;
goto error;
case kFPObjectNotFound:
if ((flags & O_CREAT) &&
(ml_creat(volume,path,0644)==0)) {
/* FIXME 0644 is just made up */
goto try_again;
} else {
ret=ENOENT;
goto error;
}
case kFPObjectLocked:
ret=EROFS;
goto error;
case kFPObjectTypeErr:
ret=EISDIR;
goto error;
case kFPParamErr:
ret=EACCES;
goto error;
case kFPTooManyFilesOpen:
ret=EMFILE;
goto error;
case kFPVolLocked:
case kFPDenyConflict:
case kFPMiscErr:
case kFPBitmapErr:
case -1:
ret=EFAULT;
goto error;
case 0:
ret=0;
break;
default:
ret=EFAULT;
goto error;
}
add_opened_fork(volume, fp);
if ((flags & O_TRUNC) && (!create_file)) {
/* This is the case where we want to truncate the
the file and it already exists. */
if ((ret=ll_zero_file(volume,fp->forkid,fp->resource)))
goto error;
}
return 0;
error:
return -ret;
}
int ll_read(struct afp_volume * volume,
char *buf, size_t size, off_t offset,
struct afp_file_info *fp, int * eof)
{
int bytesleft=size;
int totalsize=0;
int ret=0;
int rc;
unsigned int bufsize=min(volume->server->rx_quantum,size);
struct afp_rx_buffer buffer;
*eof=0;
buffer.data = buf;
buffer.maxsize=bufsize;
buffer.size=0;
/* Lock the range */
if (ll_handle_locking(volume, fp->forkid,offset,size)) {
/* There was an irrecoverable error when locking */
ret=EBUSY;
goto error;
}
if (volume->server->using_version->av_number < 30)
rc=afp_read(volume, fp->forkid,offset,size,&buffer);
else
rc=afp_readext(volume, fp->forkid,offset,size,&buffer);
if (ll_handle_unlocking(volume, fp->forkid,offset,size)) {
/* Somehow, we couldn't unlock the range. */
ret=EIO;
goto error;
}
switch(rc) {
case kFPAccessDenied:
ret=EACCES;
goto error;
case kFPLockErr:
ret=EBUSY;
goto error;
case kFPMiscErr:
case kFPParamErr:
ret=EIO;
goto error;
case kFPEOFErr:
*eof=1;
break;
case kFPNoErr:
break;
}
bytesleft-=buffer.size;
totalsize+=buffer.size;
return totalsize;
error:
return -ret;
}
int ll_readdir(struct afp_volume * volume, const char *path,
struct afp_file_info **fb, int resource)
{
struct afp_file_info * p, * filebase=NULL, *base, *last=NULL;
unsigned short reqcount=20; /* Get them in batches of 20 */
unsigned long startindex=1;
int rc=0, ret=0, exit=0;
unsigned int filebitmap, dirbitmap;
char basename[AFP_MAX_PATH];
char converted_name[AFP_MAX_PATH];
unsigned int dirid;
if (invalid_filename(volume->server,path))
return -ENAMETOOLONG;
if (get_dirid(volume, path, basename, &dirid)<0)
return -ENOENT;
/* We need to handle length bits differently for AFP < 3.0 */
filebitmap=kFPAttributeBit | kFPParentDirIDBit |
kFPCreateDateBit | kFPModDateBit |
kFPBackupDateBit|
kFPNodeIDBit;
dirbitmap=kFPAttributeBit | kFPParentDirIDBit |
kFPCreateDateBit | kFPModDateBit |
kFPBackupDateBit|
kFPNodeIDBit | kFPOffspringCountBit|
kFPOwnerIDBit|kFPGroupIDBit;
if (volume->extra_flags & VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX) {
dirbitmap|=kFPUnixPrivsBit;
filebitmap|=kFPUnixPrivsBit;
}
if (volume->attributes & kSupportsUTF8Names ) {
dirbitmap|=kFPUTF8NameBit;
filebitmap|=kFPUTF8NameBit;
} else {
dirbitmap|=kFPLongNameBit| kFPShortNameBit;
filebitmap|=kFPLongNameBit| kFPShortNameBit;
}
if (volume->server->using_version->av_number<30) {
filebitmap |=(resource ? kFPRsrcForkLenBit:kFPDataForkLenBit);
} else {
filebitmap |=(resource ? kFPRsrcForkLenBit:kFPExtDataForkLenBit);
}
while (!exit) {
/* FIXME: check AFP version */
/* this function will allocate and generate a linked list
of files */
if (volume->server->using_version->av_number<30) {
rc = afp_enumerate(volume,dirid,
filebitmap, dirbitmap,reqcount,
startindex,basename,&base);
} else {
rc = afp_enumerateext2(volume,dirid,
filebitmap, dirbitmap,reqcount,
startindex,basename,&base);
}
switch(rc) {
case -1:
ret=EIO;
goto error;
case 0:
case kFPObjectNotFound:
if (filebase==NULL) filebase=base;
else last->next=base;
for (p=base; p; p=p->next) {
startindex++;
last=p;
}
if (rc==kFPObjectNotFound) exit=1;
break;
case kFPAccessDenied:
ret=EACCES;
goto error;
case kFPDirNotFound:
ret=ENOENT;
exit++;
break;
case kFPBitmapErr:
case kFPMiscErr:
case kFPObjectTypeErr:
case kFPParamErr:
case kFPCallNotSupported:
ret=EIO;
goto error;
}
}
for (p=filebase; p; p=p->next) {
/* Convert all the names back to precomposed */
convert_path_to_unix(
volume->server->path_encoding,
converted_name,p->name, AFP_MAX_PATH);
startindex++;
}
if (volume->server->using_version->av_number<30) {
for (p=filebase; p; p=p->next) {
set_nonunix_perms(&p->unixprivs.permissions, p);
}
}
*fb=filebase;
return 0;
error:
return -ret;
}
int ll_getattr(struct afp_volume * volume, const char *path, struct stat *stbuf,
int resource)
{
struct afp_file_info fp;
unsigned int dirid;
int rc;
unsigned int filebitmap, dirbitmap;
char basename[AFP_MAX_PATH];
unsigned int creation_date;
unsigned int modification_date;
memset(stbuf, 0, sizeof(struct stat));
if ((volume->server) &&
(invalid_filename(volume->server,path)))
return -ENAMETOOLONG;
if (get_dirid(volume, path, basename, &dirid)<0) {
return -ENOENT;
}
dirbitmap=kFPAttributeBit
| kFPCreateDateBit | kFPModDateBit|
kFPNodeIDBit |
kFPParentDirIDBit | kFPOffspringCountBit;
filebitmap=kFPAttributeBit |
kFPCreateDateBit | kFPModDateBit |
kFPNodeIDBit |
kFPFinderInfoBit |
kFPParentDirIDBit;
if (volume->server->using_version->av_number < 30) {
if (path[0]=='/' && path[1]=='\0') {
/* This will sound odd, but when referring to /, AFP 2.x
clients check on a 'file' with the volume name. */
snprintf(basename,AFP_MAX_PATH,"%s",
volume->volume_name);
dirid=1;
}
filebitmap |=(resource ? kFPRsrcForkLenBit:kFPDataForkLenBit);
} else {
filebitmap |=(resource ? kFPExtRsrcForkLenBit:kFPExtDataForkLenBit);
}
if (volume->extra_flags & VOLUME_EXTRA_FLAGS_VOL_SUPPORTS_UNIX) {
dirbitmap|= kFPUnixPrivsBit;
filebitmap|= kFPUnixPrivsBit;
} else {
dirbitmap|=kFPOwnerIDBit | kFPGroupIDBit;
}
rc=afp_getfiledirparms(volume,dirid,filebitmap,dirbitmap,
(char *) basename,&fp);
switch(rc) {
case kFPAccessDenied:
return -EACCES;
case kFPObjectNotFound:
return -ENOENT;
case kFPNoErr:
break;
case kFPBitmapErr:
case kFPMiscErr:
case kFPParamErr:
default:
return -EIO;
}
if (volume->server->using_version->av_number>=30 && fp.unixprivs.permissions != 0)
stbuf->st_mode |= fp.unixprivs.permissions;
else
set_nonunix_perms((mode_t *)&stbuf->st_mode,&fp);
stbuf->st_uid=fp.unixprivs.uid;
stbuf->st_gid=fp.unixprivs.gid;
if (translate_uidgid_to_client(volume,
&stbuf->st_uid,&stbuf->st_gid)) {
return -EIO;
}
if (stbuf->st_mode & S_IFDIR) {
stbuf->st_nlink = fp.offspring +2;
stbuf->st_size = (fp.offspring *34) + 24;
/* This slight voodoo was taken from Mac OS X 10.2 */
} else {
stbuf->st_nlink = 1;
stbuf->st_size = (resource ? fp.resourcesize : fp.size);
stbuf->st_blksize = 4096;
stbuf->st_blocks = (stbuf->st_size) / 4096;
}
if ((volume->server->using_version->av_number<30) &&
(stbuf->st_mode & S_IFDIR)) {
/* AFP 2.x doesn't give ctime and mtime for directories*/
creation_date=volume->server->connect_time;
modification_date=volume->server->connect_time;
} else {
creation_date=fp.creation_date;
modification_date=fp.modification_date;
}
#ifdef __linux__
stbuf->st_ctim.tv_sec=creation_date;
stbuf->st_mtim.tv_sec=modification_date;
#else
stbuf->st_ctime=creation_date;
stbuf->st_mtime=modification_date;
#endif
return 0;
}
int ll_write(struct afp_volume * volume,
const char *data, size_t size, off_t offset,
struct afp_file_info * fp, size_t * totalwritten)
{
int ret,err=0;
uint64_t sizetowrite, ignored;
uint32_t ignored32;
unsigned int max_packet_size=volume->server->tx_quantum;
off_t o=0;
*totalwritten=0;
if (!fp) return -EBADF;
/* Get a lock */
if (ll_handle_locking(volume, fp->forkid,offset,size)) {
/* There was an irrecoverable error when locking */
ret=EBUSY;
goto error;
}
ret=0;
while (*totalwritten < size) {
sizetowrite=max_packet_size;
if ((size-*totalwritten)<max_packet_size)
sizetowrite=size-*totalwritten;
if (volume->server->using_version->av_number < 30)
ret=afp_write(volume, fp->forkid,
offset+o,sizetowrite,
(char *) data+o,&ignored32);
else
ret=afp_writeext(volume, fp->forkid,
offset+o,sizetowrite,
(char *) data+o,&ignored);
ret=0;
*totalwritten+=sizetowrite;
switch(ret) {
case kFPAccessDenied:
err=EACCES;
goto error;
case kFPDiskFull:
err=ENOSPC;
goto error;
case kFPLockErr:
case kFPMiscErr:
case kFPParamErr:
err=EINVAL;
goto error;
}
o+=sizetowrite;
}
if (ll_handle_unlocking(volume, fp->forkid,offset,size)) {
/* Somehow, we couldn't unlock the range. */
ret=EIO;
goto error;
}
return 0;
error:
return -err;
}

35
lib/lowlevel.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef __LOWLEVEL_H_
#define __LOWLEVEL_H_
int ll_get_directory_entry(struct afp_volume * volume,
char * basename,
unsigned int dirid,
unsigned int filebitmap, unsigned int dirbitmap,
struct afp_file_info *p);
int ll_readdir(struct afp_volume * volume, const char *path,
struct afp_file_info **fb, int resource);
int ll_getattr(struct afp_volume * volume, const char *path, struct stat *stbuf,
int resourcefork);
int ll_zero_file(struct afp_volume * volume, unsigned short forkid,
unsigned int resource);
int ll_read(struct afp_volume * volume,
char *buf, size_t size, off_t offset,
struct afp_file_info *fp, int * eof);
int ll_handle_unlocking(struct afp_volume * volume,unsigned short forkid,
uint64_t offset, uint64_t sizetorequest);
int ll_handle_locking(struct afp_volume * volume,unsigned short forkid,
uint64_t offset, uint64_t sizetorequest);
int ll_write(struct afp_volume * volume,
const char *data, size_t size, off_t offset,
struct afp_file_info * fp, size_t * totalwritten);
int ll_open(struct afp_volume * volume, const char *path, int flags,
struct afp_file_info *fp);
#endif

30
lib/map_def.c Normal file
View File

@ -0,0 +1,30 @@
#include <string.h>
#include "afpfs-ng/afp.h"
#include "afpfs-ng/map_def.h"
static char *afp_map_strings[] = {
"Unknown",
"Common user directory",
"Login ids",
"Name mapped",
"",
};
char * get_mapping_name(struct afp_volume * volume)
{
return afp_map_strings[volume->mapping];
}
unsigned int map_string_to_num(char * name)
{
int i;
for (i=0;strlen(afp_map_strings[i])>0;i++) {
if (strcasecmp(name,afp_map_strings[i])==0)
return i;
}
return 0;
}

77
lib/meta.c Normal file
View File

@ -0,0 +1,77 @@
/*
Copyright (C) 2006 Alex deVries <alexthepuffin@gmail.com>
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <asm/fcntl.h>
#include <utime.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include "afpfs-ng/afp.h"
#include "afpfs-ng/dsi.h"
#include "afpfs-ng/afp_protocol.h"
#include "afpfs-ng/utils.h"
int afp_meta_getattr(const char *path, struct stat *stbuf)
{
if (is_apple(path))
{
log_for_client(NULL,AFPFSD,LOG_DEBUG,
"Is apple\n");
stbuf->st_mode = S_IFDIR | 0755;
stbuf->st_nlink=2;
return 0;
}
resource=apple_translate(volume,path);
return resource;
}
static int afp_meta_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
{
(void) offset;
(void) fi;
unsigned int dirid=0;
struct afp_file_info * filebase = NULL, * p, *prev;
unsigned short reqcount=20; /* Get them in batches of 20 */
unsigned long startindex=1;
int rc=0, ret=0, exit=0;
unsigned int filebitmap, dirbitmap;
struct afp_volume * volume=
(struct afp_volume *)
((struct fuse_context *)(fuse_get_context()))->private_data;
}
static int afp_meta_open(const char *path, struct fuse_file_info *fi)
{
}
static int afp_meta_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
}
static int afp_meta_truncate(const char * path, off_t offset)
{
}

11
lib/meta.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef _META_H_
#define _META_H_
struct query_geticon {
unsigned int filecreator;
unsigned int filetype;
unsigned char icontype;
unsigned short length;
};
#endif

1395
lib/midlevel.c Normal file

File diff suppressed because it is too large Load Diff

226
lib/proto_attr.c Normal file
View File

@ -0,0 +1,226 @@
/*
* attr.c
*
* Copyright (C) 2006 Alex deVries
*
*/
#include <string.h>
#include <stdlib.h>
#include "afpfs-ng/dsi.h"
#include "afpfs-ng/afp.h"
#include "afpfs-ng/utils.h"
#include "afpfs-ng/afp_protocol.h"
#include "dsi_protocol.h"
/* This is a new command, function 76. There are currently no docs, so this
* can be nothing but a rough implementation. It is possible to create
* some sort of reverse-engineered parser for the return. */
int afp_newcommand76(struct afp_volume * volume, unsigned int dlen, char * data)
{
struct {
struct dsi_header dsi_header __attribute__((__packed__));
uint8_t command;
uint8_t pad;
uint16_t volid ;
} __attribute__((__packed__)) *request_packet;
struct afp_server * server=volume->server;
unsigned int len = sizeof(*request_packet)+dlen;
int ret;
char * msg = malloc(len);
if (!msg) {
log_for_client(NULL,AFPFSD,LOG_WARNING,"Out of memory\n");
return -1;
};
request_packet=(void *) msg;
dsi_setup_header(server,&request_packet->dsi_header,DSI_DSICommand);
request_packet->command=76;
request_packet->pad=0;
request_packet->volid=htons(volume->volid);
char * p=msg+sizeof(*request_packet);
memcpy(p, data,dlen);
ret=dsi_send(server, msg, len,DSI_DEFAULT_TIMEOUT, 76 , NULL);
free(msg);
return ret;
}
int afp_listextattr(struct afp_volume * volume,
unsigned int dirid, unsigned short bitmap,
char * pathname, struct afp_extattr_info * info)
{
struct {
struct dsi_header dsi_header __attribute__((__packed__));
uint8_t command;
uint8_t pad;
uint16_t volid ;
uint32_t dirid ;
uint16_t bitmap;
uint16_t reqcount;
uint32_t startindex;
uint32_t maxreplysize;
} __attribute__((__packed__)) *request_packet;
struct afp_server * server=volume->server;
unsigned int len = sizeof(*request_packet)+sizeof_path_header(server)+strlen(pathname);
char * pathptr;
int ret;
char * msg = malloc(len);
if (!msg) {
log_for_client(NULL,AFPFSD,LOG_WARNING,"Out of memory\n");
return -1;
};
pathptr = msg + (sizeof(*request_packet));
request_packet=(void *) msg;
dsi_setup_header(server,&request_packet->dsi_header,DSI_DSICommand);
request_packet->command=afpListExtAttrs;
request_packet->pad=0;
request_packet->volid=htons(volume->volid);
request_packet->dirid=htonl(dirid);
request_packet->reqcount=0;
request_packet->startindex=0;
request_packet->bitmap=htons(bitmap);
request_packet->maxreplysize=hton64(info->maxsize);
copy_path(server,pathptr,pathname,strlen(pathname));
unixpath_to_afppath(server,pathptr);
ret=dsi_send(server, (char *) request_packet,len,DSI_DEFAULT_TIMEOUT,
afpListExtAttrs , (void *) info);
free(msg);
return ret;
}
int afp_listextattrs_reply(struct afp_server * server, char * buf,
unsigned int size, void * x)
{
struct {
struct dsi_header header __attribute__((__packed__));
uint16_t reserved ;
uint32_t datalength ;
char * data ;
} __attribute__((__packed__)) * reply = (void *) buf;
struct afp_extattr_info * i = x;
unsigned int len = min(i->maxsize,ntohl(reply->datalength));
i->size=len;
/* Todo: make sure we don't go past the end of the buffer */
memcpy(&i->data,&reply->data,len) ;
return 0;
}
int afp_getextattr(struct afp_volume * volume, unsigned int dirid,
unsigned short bitmap, unsigned int replysize ,
char * pathname,
unsigned short namelen, char * name, struct afp_extattr_info * i)
{
struct {
struct dsi_header dsi_header __attribute__((__packed__));
uint8_t command;
char pad;
uint16_t volid ;
uint32_t dirid ;
uint16_t bitmap ;
uint64_t offset ;
uint64_t reqcount;
uint32_t replysize;
} __attribute__((__packed__)) *request_packet;
struct {
uint16_t len;
char * name ;
} __attribute__((__packed__)) * req2;
struct afp_server * server = volume->server;
unsigned int len = sizeof(*request_packet)+
sizeof_path_header(server)+strlen(pathname)
+1+sizeof(unsigned int) + strlen(name);
char * p,*p2;
int ret;
char * msg = malloc(len);
if (!msg) {
log_for_client(NULL,AFPFSD,LOG_WARNING,"Out of memory\n");
return -1;
};
p= msg + (sizeof(*request_packet));
request_packet=(void *) msg;
dsi_setup_header(server,&request_packet->dsi_header,DSI_DSICommand);
request_packet->command=afpGetExtAttr;
request_packet->pad=0;
request_packet->volid=htons(volume->volid);
request_packet->dirid=htonl(dirid);
request_packet->offset=hton64(0);
request_packet->reqcount=hton64(0);
request_packet->replysize=htonl(replysize);
copy_path(server,p,pathname,strlen(pathname));
unixpath_to_afppath(server,p);
p2=p+sizeof_path_header(server)+strlen(pathname);
if (((unsigned long) p2) & 0x1) p2++;
req2=(void *) p2;
req2->len=htons(namelen);
memcpy(&req2->name,name,namelen);
len=(p2+namelen)-msg;
ret=dsi_send(server, (char *) request_packet,len,DSI_DEFAULT_TIMEOUT,
afpDelete ,(void *) i);
free(msg);
return ret;
}
int afp_setextattr(struct afp_volume * volume, unsigned int dirid,
unsigned short bitmap, uint64_t offset, char * pathname,
unsigned short namelen, char * name, unsigned int attribdatalen,
char * attribdata)
{
struct {
struct dsi_header dsi_header __attribute__((__packed__));
uint8_t command;
uint8_t pad;
uint16_t volid ;
uint32_t dirid ;
uint16_t bitmap ;
uint64_t offset ;
} __attribute__((__packed__)) *request_packet;
struct afp_server * server = volume->server;
unsigned int len = sizeof(*request_packet)+sizeof_path_header(server)+strlen(pathname);
char * pathptr;
int ret;
char * msg = malloc(len);
if (!msg) {
log_for_client(NULL,AFPFSD,LOG_WARNING,"Out of memory\n");
return -1;
};
pathptr = msg + (sizeof(*request_packet));
request_packet=(void *) msg;
dsi_setup_header(server,&request_packet->dsi_header,DSI_DSICommand);
request_packet->command=afpSetExtAttr;
request_packet->pad=0;
request_packet->volid=htons(volume->volid);
request_packet->dirid=htonl(dirid);
copy_path(server,pathptr,pathname,strlen(pathname));
unixpath_to_afppath(server,pathptr);
ret=dsi_send(server, (char *) request_packet,len,DSI_DEFAULT_TIMEOUT,
afpDelete ,NULL);
free(msg);
return ret;
}

Some files were not shown because too many files have changed in this diff Show More