├── AUTHORS ├── CONTRIBUTORS ├── COPYING ├── COPYRIGHT ├── Makefile.am ├── Makefile.in ├── NEWS ├── README.md ├── VERSION ├── abigen.sh ├── aclocal.m4 ├── bin ├── Makefile.am ├── Makefile.in ├── ad │ ├── Makefile.am │ ├── Makefile.in │ ├── ad.c │ ├── ad.h │ ├── ad_cp.c │ ├── ad_find.c │ ├── ad_ls.c │ ├── ad_mv.c │ ├── ad_rm.c │ ├── ad_set.c │ └── ad_util.c ├── afppasswd │ ├── Makefile.am │ ├── Makefile.in │ └── afppasswd.c ├── cnid │ ├── Makefile.am │ ├── Makefile.in │ └── cnid2_create.in ├── megatron │ ├── Makefile.am │ └── Makefile.in └── misc │ ├── Makefile.am │ ├── Makefile.in │ ├── fce.c │ ├── logger_test.c │ ├── netacnv.c │ └── uuidtest.c ├── compile ├── config.guess ├── config.h.in ├── config.sub ├── config ├── Makefile.am ├── Makefile.in ├── README ├── afp.conf.tmpl ├── dbus-session.conf.tmpl ├── extmap.conf ├── netatalk-dbus.conf └── pam │ ├── Makefile.am │ ├── Makefile.in │ └── netatalk.tmpl ├── configure ├── configure.ac ├── contrib ├── Makefile.am ├── Makefile.in ├── macusers │ ├── Makefile.am │ ├── Makefile.in │ ├── README.macusers │ └── macusers.in └── shell_utils │ ├── Makefile.am │ ├── Makefile.in │ ├── afpstats │ ├── apple_dump.in │ ├── asip-status.pl.in │ ├── fce_ev_script.sh │ ├── make-casetable.pl │ └── make-precompose.h.pl ├── debian ├── NEWS ├── README.Debian ├── README.source ├── afp.conf ├── changelog ├── compat ├── control ├── control.in ├── copyright ├── copyright_hints ├── examples │ └── netatalk_update.sh ├── gbp.conf ├── libatalk-dev.install ├── libatalk18.install ├── netatalk.dirs ├── netatalk.docs ├── netatalk.ignore ├── netatalk.install ├── netatalk.logcheck.ignore.server ├── netatalk.logcheck.violations.ignore ├── netatalk.logrotate ├── netatalk.pam ├── patches │ ├── 101_start_avahi-daemon_before_atalkd.patch │ ├── 114_fix_macusers_ps_parsing.patch │ ├── 201_etc2ps_paths.diff │ ├── 202_psf_8_paths.diff │ ├── 205_applevolumes_default_homedir.diff │ ├── 402_init_lsb.patch │ ├── README │ └── series ├── rules ├── source │ ├── format │ └── options └── watch ├── depcomp ├── distrib ├── Makefile.am ├── Makefile.in ├── config │ ├── Makefile.am │ ├── Makefile.in │ └── netatalk-config.in ├── initscripts │ ├── Makefile.am │ ├── Makefile.in │ ├── netatalk.xml.tmpl │ ├── rc.bsd.tmpl │ ├── rc.debian.tmpl │ ├── rc.gentoo.tmpl │ ├── rc.netbsd.tmpl │ ├── rc.redhat.tmpl │ ├── rc.solaris.tmpl │ ├── rc.suse.tmpl │ └── service.systemd.tmpl └── m4 │ ├── Makefile.am │ ├── Makefile.in │ └── netatalk.m4 ├── doc ├── Makefile.am ├── Makefile.in ├── html.xsl.in ├── man.xsl.in ├── manpages │ ├── Makefile.am │ ├── Makefile.in │ ├── man1 │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── ad.1.xml │ │ ├── afpldaptest.1.xml │ │ ├── afppasswd.1.xml │ │ ├── afpstats.1.xml │ │ ├── apple_dump.1.xml │ │ ├── asip-status.pl.1.xml │ │ ├── dbd.1.xml │ │ ├── macusers.1.xml │ │ ├── megatron.1.xml │ │ ├── netatalk-config.1.xml │ │ └── uniconv.1.xml │ ├── man5 │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── afp.conf.5.xml │ │ ├── afp_signature.conf.5.xml │ │ ├── afp_voluuid.conf.5.xml │ │ └── extmap.conf.5.xml │ └── man8 │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── afpd.8.xml │ │ ├── cnid_dbd.8.xml │ │ ├── cnid_metad.8.xml │ │ └── netatalk.8.xml └── manual │ ├── Makefile.am │ ├── Makefile.in │ ├── configuration.xml │ ├── install.xml │ ├── intro.xml │ ├── manual.xml.in │ ├── netatalk.html │ └── upgrade.xml ├── etc ├── Makefile.am ├── Makefile.in ├── afpd │ ├── Makefile.am │ ├── Makefile.in │ ├── acl_mappings.h │ ├── acls.c │ ├── acls.h │ ├── afp_config.c │ ├── afp_config.h │ ├── afp_dsi.c │ ├── afp_options.c │ ├── afp_util.c │ ├── afprun.c │ ├── afpstats-service.xml │ ├── afpstats.c │ ├── afpstats.h │ ├── afpstats_obj.c │ ├── afpstats_obj.h │ ├── afpstats_service_glue.h │ ├── afs.c │ ├── appl.c │ ├── auth.c │ ├── auth.h │ ├── catsearch.c │ ├── desktop.c │ ├── desktop.h │ ├── dircache.c │ ├── dircache.h │ ├── directory.c │ ├── directory.h │ ├── enumerate.c │ ├── extattrs.c │ ├── extattrs.h │ ├── fce_api.c │ ├── fce_api_internal.h │ ├── fce_util.c │ ├── file.c │ ├── file.h │ ├── filedir.c │ ├── filedir.h │ ├── fork.c │ ├── fork.h │ ├── hash.c │ ├── hash.h │ ├── icon.h │ ├── main.c │ ├── mangle.c │ ├── mangle.h │ ├── messages.c │ ├── misc.h │ ├── nfsquota.c │ ├── ofork.c │ ├── quota.c │ ├── spotlight.c │ ├── spotlight_marshalling.c │ ├── status.c │ ├── status.h │ ├── switch.c │ ├── switch.h │ ├── uam.c │ ├── uam_auth.h │ ├── uid.c │ ├── uid.h │ ├── unix.c │ ├── unix.h │ ├── volume.c │ └── volume.h ├── cnid_dbd │ ├── Makefile.am │ ├── Makefile.in │ ├── cmd_dbd.c │ ├── cmd_dbd.h │ ├── cmd_dbd_scanvol.c │ ├── cnid_metad.c │ ├── comm.c │ ├── comm.h │ ├── db_param.c │ ├── db_param.h │ ├── dbd.h │ ├── dbd_add.c │ ├── dbd_dbcheck.c │ ├── dbd_delete.c │ ├── dbd_get.c │ ├── dbd_getstamp.c │ ├── dbd_lookup.c │ ├── dbd_rebuild_add.c │ ├── dbd_resolve.c │ ├── dbd_search.c │ ├── dbd_update.c │ ├── dbif.c │ ├── dbif.h │ ├── main.c │ ├── pack.c │ ├── pack.h │ ├── usockfd.c │ └── usockfd.h ├── netatalk │ ├── Makefile.am │ ├── Makefile.in │ ├── afp_avahi.c │ ├── afp_avahi.h │ ├── afp_mdns.c │ ├── afp_mdns.h │ ├── afp_zeroconf.c │ ├── afp_zeroconf.h │ └── netatalk.c ├── spotlight │ ├── Makefile.am │ ├── Makefile.in │ ├── sparql_map.c │ ├── sparql_map.h │ ├── sparql_parser.c │ ├── sparql_parser.h │ ├── sparql_parser.y │ ├── spotlight_rawquery_lexer.c │ └── spotlight_rawquery_lexer.l └── uams │ ├── Makefile.am │ ├── Makefile.in │ ├── openssl_compat.h │ ├── uams_dhx2_pam.c │ ├── uams_dhx2_passwd.c │ ├── uams_dhx_pam.c │ ├── uams_dhx_passwd.c │ ├── uams_gss.c │ ├── uams_guest.c │ ├── uams_pam.c │ ├── uams_passwd.c │ ├── uams_pgp.c │ └── uams_randnum.c ├── include ├── Makefile.am ├── Makefile.in └── atalk │ ├── Makefile.am │ ├── Makefile.in │ ├── acl.h │ ├── adouble.h │ ├── afp.h │ ├── afp_dtrace.d │ ├── bstradd.h │ ├── bstrlib.h │ ├── byteorder.h │ ├── cnid.h │ ├── cnid_bdb_private.h │ ├── cnid_mysql_private.h │ ├── cnid_private.h │ ├── compat.h │ ├── dalloc.h │ ├── dictionary.h │ ├── directory.h │ ├── dsi.h │ ├── ea.h │ ├── errchk.h │ ├── fce_api.h │ ├── ftw.h │ ├── globals.h │ ├── hash.h │ ├── iniparser.h │ ├── ldapconfig.h │ ├── list.h │ ├── logger.h │ ├── netatalk_conf.h │ ├── paths.h │ ├── queue.h │ ├── server_child.h │ ├── server_ipc.h │ ├── spotlight.h │ ├── standards.h │ ├── talloc.h │ ├── tdb.h │ ├── uam.h │ ├── unicode.h │ ├── unix.h │ ├── util.h │ ├── uuid.h │ ├── vfs.h │ └── volume.h ├── install-sh ├── libatalk ├── Makefile.am ├── Makefile.in ├── acl │ ├── Makefile.am │ ├── Makefile.in │ ├── aclldap.h │ ├── cache.c │ ├── cache.h │ ├── ldap.c │ ├── ldap_config.c │ ├── unix.c │ └── uuid.c ├── adouble │ ├── Makefile.am │ ├── Makefile.in │ ├── ad_attr.c │ ├── ad_conv.c │ ├── ad_date.c │ ├── ad_flush.c │ ├── ad_lock.c │ ├── ad_lock.h │ ├── ad_mmap.c │ ├── ad_open.c │ ├── ad_read.c │ ├── ad_recvfile.c │ ├── ad_sendfile.c │ ├── ad_size.c │ └── ad_write.c ├── bstring │ ├── Makefile.am │ ├── Makefile.in │ ├── bstradd.c │ └── bstrlib.c ├── cnid │ ├── Makefile.am │ ├── Makefile.in │ ├── README │ ├── cdb │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── README │ │ ├── cnid_cdb.h │ │ ├── cnid_cdb_add.c │ │ ├── cnid_cdb_close.c │ │ ├── cnid_cdb_delete.c │ │ ├── cnid_cdb_get.c │ │ ├── cnid_cdb_lookup.c │ │ ├── cnid_cdb_meta.c │ │ ├── cnid_cdb_meta.h │ │ ├── cnid_cdb_nextid.c │ │ ├── cnid_cdb_open.c │ │ ├── cnid_cdb_private.h │ │ ├── cnid_cdb_rebuild_add.c │ │ ├── cnid_cdb_resolve.c │ │ └── cnid_cdb_update.c │ ├── cnid.c │ ├── cnid_init.c │ ├── dbd │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── cnid_dbd.c │ │ └── cnid_dbd.h │ ├── last │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── README │ │ ├── cnid_last.c │ │ └── cnid_last.h │ ├── mysql │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ └── cnid_mysql.c │ └── tdb │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── README │ │ ├── cnid_tdb.h │ │ ├── cnid_tdb_add.c │ │ ├── cnid_tdb_close.c │ │ ├── cnid_tdb_delete.c │ │ ├── cnid_tdb_get.c │ │ ├── cnid_tdb_lookup.c │ │ ├── cnid_tdb_nextid.c │ │ ├── cnid_tdb_open.c │ │ ├── cnid_tdb_resolve.c │ │ └── cnid_tdb_update.c ├── compat │ ├── Makefile.am │ ├── Makefile.in │ ├── getusershell.c │ ├── misc.c │ ├── mktemp.c │ ├── pselect.c │ ├── rquota_xdr.c │ └── strlcpy.c ├── dsi │ ├── Makefile.am │ ├── Makefile.in │ ├── README │ ├── dsi_attn.c │ ├── dsi_close.c │ ├── dsi_cmdreply.c │ ├── dsi_getsess.c │ ├── dsi_getstat.c │ ├── dsi_init.c │ ├── dsi_opensess.c │ ├── dsi_read.c │ ├── dsi_stream.c │ ├── dsi_tcp.c │ ├── dsi_tickle.c │ └── dsi_write.c ├── dummy.c ├── iniparser │ ├── Makefile.am │ ├── Makefile.in │ ├── dictionary.c │ └── iniparser.c ├── libatalk-3.0.1.abi ├── libatalk-3.0.2.abi ├── libatalk-3.0.3.abi ├── libatalk-3.0.4.abi ├── libatalk-3.0.5.abi ├── libatalk-3.0.6.abi ├── libatalk-3.0.abi ├── libatalk-3.0beta1.abi ├── libatalk-3.0beta2.abi ├── libatalk-3.1.0.abi ├── libatalk-3.1.1.abi ├── libatalk-3.1.10.abi ├── libatalk-3.1.2.abi ├── libatalk-3.1.3.abi ├── libatalk-3.1.4.abi ├── libatalk-3.1.5.abi ├── libatalk-3.1.6.abi ├── libatalk-3.1.8.abi ├── talloc │ ├── Makefile.am │ ├── Makefile.in │ ├── dalloc.c │ └── talloc.c ├── tdb │ ├── Makefile.am │ ├── Makefile.in │ ├── check.c │ ├── dump.c │ ├── error.c │ ├── freelist.c │ ├── freelistcheck.c │ ├── io.c │ ├── lock.c │ ├── open.c │ ├── tdb.c │ ├── tdb_private.h │ ├── transaction.c │ └── traverse.c ├── unicode │ ├── Makefile.am │ ├── Makefile.in │ ├── charcnv.c │ ├── charsets │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── generic_cjk.c │ │ ├── generic_cjk.h │ │ ├── generic_mb.c │ │ ├── generic_mb.h │ │ ├── mac_centraleurope.c │ │ ├── mac_centraleurope.h │ │ ├── mac_chinese_simp.c │ │ ├── mac_chinese_simp.h │ │ ├── mac_chinese_trad.c │ │ ├── mac_chinese_trad.h │ │ ├── mac_cyrillic.c │ │ ├── mac_cyrillic.h │ │ ├── mac_greek.c │ │ ├── mac_greek.h │ │ ├── mac_hebrew.c │ │ ├── mac_hebrew.h │ │ ├── mac_japanese.c │ │ ├── mac_japanese.h │ │ ├── mac_korean.c │ │ ├── mac_korean.h │ │ ├── mac_roman.c │ │ ├── mac_roman.h │ │ ├── mac_turkish.c │ │ └── mac_turkish.h │ ├── iconv.c │ ├── precompose.h │ ├── utf16_case.c │ ├── utf16_casetable.h │ ├── utf8.c │ └── util_unistr.c ├── util │ ├── Makefile.am │ ├── Makefile.in │ ├── bprint.c │ ├── cnid.c │ ├── fault.c │ ├── ftw.c │ ├── getiface.c │ ├── gettok.c │ ├── locking.c │ ├── logger.c │ ├── module.c │ ├── netatalk_conf.c │ ├── queue.c │ ├── server_child.c │ ├── server_ipc.c │ ├── server_lock.c │ ├── socket.c │ ├── strdicasecmp.c │ └── unix.c └── vfs │ ├── Makefile.am │ ├── Makefile.in │ ├── acl.c │ ├── ea_ad.c │ ├── ea_sys.c │ ├── extattr.c │ ├── unix.c │ └── vfs.c ├── libevent ├── ChangeLog ├── Doxyfile ├── LICENSE ├── Makefile.am ├── Makefile.in ├── Makefile.nmake ├── README ├── WIN32-Code │ ├── event2 │ │ └── event-config.h │ └── tree.h ├── aclocal.m4 ├── arc4random.c ├── autogen.sh ├── buffer.c ├── buffer_iocp.c ├── bufferevent-internal.h ├── bufferevent.c ├── bufferevent_async.c ├── bufferevent_filter.c ├── bufferevent_openssl.c ├── bufferevent_pair.c ├── bufferevent_ratelim.c ├── bufferevent_sock.c ├── changelist-internal.h ├── compat │ └── sys │ │ └── queue.h ├── compile ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.in ├── defer-internal.h ├── depcomp ├── devpoll.c ├── epoll.c ├── epoll_sub.c ├── evbuffer-internal.h ├── evdns.c ├── evdns.h ├── event-internal.h ├── event.c ├── event.h ├── event_iocp.c ├── event_rpcgen.py ├── event_tagging.c ├── evhttp.h ├── evmap-internal.h ├── evmap.c ├── evport.c ├── evrpc-internal.h ├── evrpc.c ├── evrpc.h ├── evsignal-internal.h ├── evthread-internal.h ├── evthread.c ├── evthread_pthread.c ├── evthread_win32.c ├── evutil.c ├── evutil.h ├── evutil_rand.c ├── ht-internal.h ├── http-internal.h ├── http.c ├── include │ ├── Makefile.am │ ├── Makefile.in │ └── event2 │ │ ├── buffer.h │ │ ├── buffer_compat.h │ │ ├── bufferevent.h │ │ ├── bufferevent_compat.h │ │ ├── bufferevent_ssl.h │ │ ├── bufferevent_struct.h │ │ ├── dns.h │ │ ├── dns_compat.h │ │ ├── dns_struct.h │ │ ├── event.h │ │ ├── event_compat.h │ │ ├── event_struct.h │ │ ├── http.h │ │ ├── http_compat.h │ │ ├── http_struct.h │ │ ├── keyvalq_struct.h │ │ ├── listener.h │ │ ├── rpc.h │ │ ├── rpc_compat.h │ │ ├── rpc_struct.h │ │ ├── tag.h │ │ ├── tag_compat.h │ │ ├── thread.h │ │ └── util.h ├── install-sh ├── iocp-internal.h ├── ipv6-internal.h ├── kqueue.c ├── libevent.pc.in ├── libevent_openssl.pc.in ├── libevent_pthreads.pc.in ├── listener.c ├── log-internal.h ├── log.c ├── ltmain.sh ├── m4 │ ├── acx_pthread.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ └── lt~obsolete.m4 ├── minheap-internal.h ├── missing ├── mm-internal.h ├── poll.c ├── ratelim-internal.h ├── sample │ ├── Makefile.am │ ├── Makefile.in │ ├── dns-example.c │ ├── event-test.c │ ├── hello-world.c │ ├── http-server.c │ ├── le-proxy.c │ ├── signal-test.c │ └── time-test.c ├── select.c ├── signal.c ├── strlcpy-internal.h ├── strlcpy.c ├── test │ ├── Makefile.am │ ├── Makefile.in │ ├── Makefile.nmake │ ├── bench.c │ ├── bench_cascade.c │ ├── bench_http.c │ ├── bench_httpclient.c │ ├── regress.c │ ├── regress.gen.c │ ├── regress.gen.h │ ├── regress.h │ ├── regress.rpc │ ├── regress_buffer.c │ ├── regress_bufferevent.c │ ├── regress_dns.c │ ├── regress_et.c │ ├── regress_http.c │ ├── regress_iocp.c │ ├── regress_listener.c │ ├── regress_main.c │ ├── regress_minheap.c │ ├── regress_rpc.c │ ├── regress_ssl.c │ ├── regress_testutils.c │ ├── regress_testutils.h │ ├── regress_thread.c │ ├── regress_util.c │ ├── regress_zlib.c │ ├── rpcgen_wrapper.sh │ ├── test-changelist.c │ ├── test-eof.c │ ├── test-init.c │ ├── test-ratelim.c │ ├── test-time.c │ ├── test-weof.c │ ├── test.sh │ ├── tinytest.c │ ├── tinytest.h │ ├── tinytest_local.h │ └── tinytest_macros.h ├── util-internal.h ├── whatsnew-2.0.txt └── win32select.c ├── ltmain.sh ├── macros ├── Makefile.am ├── Makefile.in ├── afs-check.m4 ├── ax_pthread.m4 ├── cnid-backend.m4 ├── config-checks.m4 ├── db3-check.m4 ├── grep-check.m4 ├── gssapi-check.m4 ├── iconv.m4 ├── largefile-check.m4 ├── libgcrypt.m4 ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 ├── lt~obsolete.m4 ├── netatalk.m4 ├── pam-check.m4 ├── perl-check.m4 ├── ps-check.m4 ├── quota-check.m4 ├── ssl-check.m4 ├── summary.m4 ├── tcp-wrappers.m4 ├── util.m4 └── zeroconf.m4 ├── man ├── Makefile.am ├── Makefile.in ├── man1 │ ├── Makefile.am │ ├── Makefile.in │ ├── ad.1.in │ ├── afpldaptest.1.in │ ├── afppasswd.1.in │ ├── afpstats.1.in │ ├── apple_dump.1.in │ ├── asip-status.pl.1.in │ ├── dbd.1.in │ ├── macusers.1.in │ ├── netatalk-config.1.in │ └── uniconv.1.in ├── man5 │ ├── Makefile.am │ ├── Makefile.in │ ├── afp.conf.5.in │ ├── afp_signature.conf.5.in │ ├── afp_voluuid.conf.5.in │ └── extmap.conf.5.in └── man8 │ ├── Makefile.am │ ├── Makefile.in │ ├── afpd.8.in │ ├── cnid_dbd.8.in │ ├── cnid_metad.8.in │ └── netatalk.8.in ├── missing ├── test-driver ├── test ├── Makefile.am ├── Makefile.in └── afpd │ ├── Makefile.am │ ├── Makefile.in │ ├── afpfunc_helpers.c │ ├── afpfunc_helpers.h │ ├── subtests.c │ ├── subtests.h │ ├── test.c │ ├── test.h │ └── test.sh └── ylwrap /Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for top level of netatalk package 2 | 3 | if USE_BUILTIN_LIBEVENT 4 | SUBDIRS = libevent include libatalk bin config etc contrib distrib doc man macros test 5 | else 6 | SUBDIRS = include libatalk bin config etc contrib distrib doc man macros test 7 | endif 8 | 9 | EXTRA_DIST = CONTRIBUTORS COPYRIGHT COPYING NEWS VERSION abigen.sh 10 | 11 | ACLOCAL_AMFLAGS = -I macros 12 | AUTOMAKE_OPTIONS = foreign 13 | 14 | if RUN_LDCONFIG 15 | install-exec-hook: 16 | @printf "Running ldconfig to ensure libraries installed in system library directories are added to the dynamic linker cache ... " 17 | @-@NETA_LDCONFIG@ 18 | @printf "done\n" 19 | endif 20 | 21 | if DEVELOPER 22 | abi-clean: 23 | @echo "Removing ABI file libatalk/libatalk-$(NETATALK_VERSION).abi" 24 | @rm -f libatalk/libatalk-$(NETATALK_VERSION).abi 25 | endif 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Obsolete, officially integrated into Debian Buster 2 | No need to use this repository anymore, netatalk-3.1 was integrated into Debian Buster. 3 | https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690227 is fixed, please get your netatalk 4 | package directly from Debian. 5 | 6 | This repository is only here for historical purposes and may eventually be deleted. It is 7 | completely unmaintained, unlike the official Debian package. 8 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 3.1.12 -------------------------------------------------------------------------------- /abigen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # generate a set of ABI signatures from a shared library 3 | 4 | SHAREDLIB="$1" 5 | 6 | GDBSCRIPT="gdb_syms.$$" 7 | 8 | ( 9 | cat < $GDBSCRIPT 18 | 19 | # forcing the terminal avoids a problem on Fedora12 20 | TERM=none gdb -batch -x $GDBSCRIPT "$SHAREDLIB" < /dev/null | sed -e 's/:\$[0-9]* = /: /g' -e 's/<[0-9a-zA-Z_]*>$//g' -e 's/0x[0-9a-f]* $//g' -e 's/0x[[:xdigit:]]* \("[[:alnum:] _-]*"\)/\1/g' -e 's/0x[[:xdigit:]]* \(<[[:alnum:] _-]*>\)/\1/g' -e 's/{\(.*\)} $/\1/g' 21 | rm -f $GDBSCRIPT 22 | -------------------------------------------------------------------------------- /bin/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for bin/ 2 | 3 | SUBDIRS = afppasswd cnid megatron misc 4 | 5 | if HAVE_ATFUNCS 6 | SUBDIRS += ad 7 | endif 8 | -------------------------------------------------------------------------------- /bin/ad/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for bin/ad/ 2 | 3 | noinst_HEADERS = ad.h 4 | 5 | if USE_BDB 6 | bin_PROGRAMS = ad 7 | 8 | ad_SOURCES = \ 9 | ad.c \ 10 | ad_find.c \ 11 | ad_util.c \ 12 | ad_ls.c \ 13 | ad_cp.c \ 14 | ad_mv.c \ 15 | ad_rm.c \ 16 | ad_set.c 17 | 18 | ad_CFLAGS = -D_PATH_AD=\"$(bindir)/ad\" 19 | 20 | ad_LDADD = \ 21 | $(top_builddir)/libatalk/libatalk.la \ 22 | @ACL_LIBS@ @MYSQL_LIBS@ 23 | 24 | endif 25 | -------------------------------------------------------------------------------- /bin/afppasswd/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for bin/afppasswd/ 2 | 3 | pkgconfdir = @PKGCONFDIR@ 4 | 5 | if HAVE_OPENSSL 6 | bin_PROGRAMS = afppasswd 7 | else 8 | bin_PROGRAMS = 9 | endif 10 | 11 | afppasswd_SOURCES = afppasswd.c 12 | afppasswd_LDADD = $(top_builddir)/libatalk/libatalk.la @SSL_LIBS@ @MYSQL_LIBS@ 13 | 14 | AM_CFLAGS = @SSL_CFLAGS@ -I$(top_srcdir)/sys \ 15 | -D_PATH_AFPDPWFILE=\"$(pkgconfdir)/afppasswd\" 16 | 17 | install-exec-hook: 18 | if HAVE_OPENSSL 19 | chmod u+s $(DESTDIR)$(bindir)/afppasswd 20 | endif 21 | -------------------------------------------------------------------------------- /bin/cnid/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for bin/cnid/ 2 | 3 | EXTRA_DIST = cnid2_create.in 4 | 5 | if USE_BDB 6 | bin_SCRIPTS = cnid2_create 7 | endif 8 | -------------------------------------------------------------------------------- /bin/megatron/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for bin/megatron/ 2 | 3 | # EXTRADIST = asingle.c hqx.c macbin.c megatron.c nad.c updcrc.c \ 4 | # asingle.h megatron.h hqx.h macbin.h nad.h updcrc.h 5 | -------------------------------------------------------------------------------- /bin/misc/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for bin/misc 2 | 3 | pkgconfdir = @PKGCONFDIR@ 4 | bin_PROGRAMS = 5 | 6 | noinst_PROGRAMS = netacnv logger_test fce 7 | 8 | netacnv_SOURCES = netacnv.c 9 | netacnv_LDADD = $(top_builddir)/libatalk/libatalk.la @MYSQL_LIBS@ 10 | 11 | logger_test_SOURCES = logger_test.c 12 | logger_test_LDADD = $(top_builddir)/libatalk/libatalk.la @MYSQL_LIBS@ 13 | 14 | fce_SOOURCE = fce.c 15 | fce_LDADD = $(top_builddir)/libatalk/libatalk.la @MYSQL_LIBS@ 16 | fce_CFLAGS = -I$(top_srcdir)/include 17 | 18 | bin_PROGRAMS += afpldaptest 19 | afpldaptest_SOURCES = uuidtest.c 20 | afpldaptest_CFLAGS = -D_PATH_CONFDIR=\"$(pkgconfdir)/\" @LDAP_CFLAGS@ 21 | afpldaptest_LDFLAGS = @LDAP_LDFLAGS@ 22 | afpldaptest_LDADD = $(top_builddir)/libatalk/libatalk.la @MYSQL_LIBS@ 23 | 24 | -------------------------------------------------------------------------------- /config/README: -------------------------------------------------------------------------------- 1 | This directory contains modifiable Netatalk configuration files and the CNID databases. -------------------------------------------------------------------------------- /config/afp.conf.tmpl: -------------------------------------------------------------------------------- 1 | ; 2 | ; Netatalk 3.x configuration file 3 | ; 4 | 5 | [Global] 6 | ; Global server settings 7 | 8 | ; [Homes] 9 | ; basedir regex = /xxxx 10 | 11 | ; [My AFP Volume] 12 | ; path = /path/to/volume 13 | 14 | ; [My Time Machine Volume] 15 | ; path = /path/to/backup 16 | ; time machine = yes 17 | -------------------------------------------------------------------------------- /config/dbus-session.conf.tmpl: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | session 6 | 7 | 9 | 10 | 11 | unix:path=:LOCALSTATEDIR:/netatalk/spotlight.ipc 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 30 | 31 | 32 | 1000000000 33 | 1000000000 34 | 1000000000 35 | 120000 36 | 240000 37 | 100000 38 | 10000 39 | 100000 40 | 10000 41 | 50000 42 | 50000 43 | 50000 44 | 45 | 46 | -------------------------------------------------------------------------------- /config/netatalk-dbus.conf: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /config/pam/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Makefile for distrib/pam/ 2 | 3 | SUFFIXES = .tmpl . 4 | EXTRA_DIST = netatalk.tmpl 5 | noinst_SCRIPTS = netatalk 6 | CLEANFILES = netatalk 7 | 8 | .tmpl: 9 | sed -e "s,[@]PAM_DIRECTIVE[@],${PAM_DIRECTIVE},g" \ 10 | -e "s,[@]PAM_AUTH[@],${PAM_AUTH}," \ 11 | -e "s,[@]PAM_ACCOUNT[@],${PAM_ACCOUNT}," \ 12 | -e "s,[@]PAM_PASSWORD[@],${PAM_PASSWORD}," \ 13 | -e "s,[@]PAM_SESSION[@],${PAM_SESSION}," \ 14 | <$< >$@ 15 | 16 | if USE_PAM 17 | pamdir = $(PAMDIR) 18 | pam_DATA = netatalk 19 | endif 20 | -------------------------------------------------------------------------------- /config/pam/netatalk.tmpl: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | auth @PAM_DIRECTIVE@ @PAM_AUTH@ 3 | account @PAM_DIRECTIVE@ @PAM_ACCOUNT@ 4 | password @PAM_DIRECTIVE@ @PAM_PASSWORD@ 5 | session @PAM_DIRECTIVE@ @PAM_SESSION@ 6 | -------------------------------------------------------------------------------- /contrib/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for contrib/ 2 | 3 | SUBDIRS = macusers shell_utils 4 | -------------------------------------------------------------------------------- /contrib/macusers/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile for contrib/macusers/ 2 | 3 | EXTRA_DIST = macusers.in README.macusers 4 | 5 | bin_SCRIPTS = macusers 6 | -------------------------------------------------------------------------------- /contrib/macusers/README.macusers: -------------------------------------------------------------------------------- 1 | This script is very similar to the nu script, but it shows more detailed 2 | information. However, since ps and lsof outputs vary, it may need some 3 | modifications to work in Unixes other than Red Hat linux. 4 | 5 | -------------------------------------------------------------------------------- /contrib/shell_utils/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile for contrib/shell_utils/ 2 | 3 | pkgconfdir = @PKGCONFDIR@ 4 | 5 | GENERATED_FILES = 6 | TEMPLATE_FILES = 7 | PERLSCRIPTS = \ 8 | asip-status.pl \ 9 | apple_dump 10 | 11 | SUFFIXES = .tmpl . 12 | 13 | .tmpl: 14 | sed -e s@:BINDIR:@${bindir}@ \ 15 | -e s@:SBINDIR:@${sbindir}@ \ 16 | -e s@:ETCDIR:@${pkgconfdir}@ \ 17 | <$< >$@ 18 | 19 | CLEANFILES = $(GENERATED_FILES) 20 | 21 | bin_SCRIPTS = $(PERLSCRIPTS) $(GENERATED_FILES) afpstats 22 | 23 | EXTRA_DIST = $(TEMPLATE_FILES) make-casetable.pl make-precompose.h.pl afpstats fce_ev_script.sh 24 | -------------------------------------------------------------------------------- /contrib/shell_utils/afpstats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | usage = """Usage: 4 | python afpstats.py 5 | """ 6 | 7 | import sys 8 | from traceback import print_exc 9 | import dbus 10 | 11 | def main(): 12 | bus = dbus.SystemBus() 13 | 14 | try: 15 | remote_object = bus.get_object("org.netatalk.AFPStats", 16 | "/org/netatalk/AFPStats") 17 | 18 | except dbus.DBusException: 19 | print_exc() 20 | sys.exit(1) 21 | 22 | iface = dbus.Interface(remote_object, "org.netatalk.AFPStats") 23 | 24 | reply = iface.GetUsers() 25 | for name in reply: 26 | print name 27 | 28 | if __name__ == '__main__': 29 | main() 30 | -------------------------------------------------------------------------------- /contrib/shell_utils/fce_ev_script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | usage="$(basename $0) [-h] [-v version] [-e event] [-P path] [-S source path] -- FCE sample script 4 | 5 | where: 6 | -h show this help text 7 | -v version 8 | -e event 9 | -P path 10 | -S source path for events like rename/move 11 | -u username 12 | -p pid 13 | -i event ID 14 | " 15 | 16 | while getopts ':hs:v:e:P:S:u:p:i:' option; do 17 | case "$option" in 18 | h) echo "$usage" 19 | exit 20 | ;; 21 | v) version=$OPTARG 22 | ;; 23 | e) event=$OPTARG 24 | ;; 25 | P) path=$OPTARG 26 | ;; 27 | S) srcpath=$OPTARG 28 | ;; 29 | u) user=$OPTARG 30 | ;; 31 | p) pid=$OPTARG 32 | ;; 33 | i) evid=$OPTARG 34 | ;; 35 | ?) printf "illegal option: '%s'\n" "$OPTARG" >&2 36 | echo "$usage" >&2 37 | exit 1 38 | ;; 39 | esac 40 | done 41 | shift $((OPTIND - 1)) 42 | 43 | printf "FCE Event: $event" >> /tmp/fce.log 44 | if [ -n "$version" ] ; then 45 | printf ", protocol: $version" >> /tmp/fce.log 46 | fi 47 | if [ -n "$evid" ] ; then 48 | printf ", ID: $evid" >> /tmp/fce.log 49 | fi 50 | if [ -n "$pid" ] ; then 51 | printf ", pid: $pid" >> /tmp/fce.log 52 | fi 53 | if [ -n "$user" ] ; then 54 | echo -n ", user: $user" >> /tmp/fce.log 55 | fi 56 | if [ -n "$srcpath" ] ; then 57 | echo -n ", source: $srcpath" >> /tmp/fce.log 58 | fi 59 | if [ -n "$path" ] ; then 60 | echo -n ", path: $path" >> /tmp/fce.log 61 | fi 62 | printf "\n" >> /tmp/fce.log 63 | -------------------------------------------------------------------------------- /debian/afp.conf: -------------------------------------------------------------------------------- 1 | ; 2 | ; Netatalk 3.x configuration file 3 | ; 4 | ; Edited to serve as example for Debian/Ubuntu by 5 | ; Martin Loschwitz 6 | ; 7 | 8 | [Global] 9 | ; Global server settings 10 | vol preset = default_for_all 11 | log file = /var/log/netatalk.log 12 | uam list = uams_randnum.so,uams_dhx.so,uams_dhx2_passwd.so 13 | save password = no 14 | 15 | [default_for_all] 16 | file perm = 0664 17 | directory perm = 0774 18 | cnid scheme = dbd 19 | ; Uncomment the following line to restrict access to specific users 20 | ; valid users = someuser 21 | 22 | [Homes] 23 | basedir regex = /home 24 | 25 | ; The following is an example for a TimeMachine compatible volume, 26 | ; limited to a size of round about 1.5 Terabyte. 27 | ; [TimeMachine] 28 | ; path = /mnt/backup/someuser 29 | ; time machine = yes 30 | ; vol size limit = 1500000 31 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/examples/netatalk_update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script was found here: 4 | # http://netatalk.sourceforge.net/wiki/index.php/DebianUpgradeto2 5 | 6 | DIR="$1" 7 | NEWDIR="${DIR}/.AppleDB" 8 | 9 | # Name binaries 10 | DBDUMPORIG=/usr/bin/db4.2_dump 11 | DBDUMPNEW=/usr/bin/db4.8_dump 12 | DBLOADNEW=/usr/bin/db4.8_load 13 | CNIDCREATOR=/usr/bin/cnid2_create 14 | 15 | ( [ -d "${DIR}" ] || [ -d "${NEWDIR}" ] ) || { 16 | echo 'Directory not supplied or does not exist. Aborting' 17 | exit 1 18 | } 19 | 20 | ([ -x ${DBDUMPORIG} ] && [ -x ${DBDUMPNEW} ] && [ -x ${DBLOADNEW} ] && [ -x ${CNIDCREATOR} ]) || { 21 | echo 'Could not find database binaries. Aborting' 22 | exit 1 23 | } 24 | 25 | echo "About to process \"${DIR}\"" 26 | echo -n "Press ^C to abort " 27 | 28 | for ii in [ 0..6 ]; do 29 | echo -n "." 30 | sleep 1 31 | done 32 | echo "." 33 | 34 | echo "Changing to \"${NEWDIR}\" directory ..." 35 | cd "${NEWDIR}" 36 | 37 | echo -n "Current directory " 38 | pwd 39 | 40 | sleep 2 41 | echo "------------------------------------------------------------------" 42 | 43 | echo "Dumping cnid.db ..." 44 | ${DBDUMPORIG} -f cnid.dump cnid.db 45 | 46 | echo "Dumping didname.db ..." 47 | ${DBDUMPORIG} -f didname.dump didname.db 48 | 49 | echo "Making new cnid2 database ..." 50 | ${CNIDCREATOR} ../ 51 | 52 | echo "Deleting old log and info files ..." 53 | rm -f __db.* log.* 54 | 55 | echo "Zipping original cnid.db and cnid.dump files." 56 | echo "(This avoids uniconv failing on finding a version 1 cnid database)" 57 | gzip cnid.db 58 | gzip cnid.dump 59 | 60 | echo 61 | 62 | echo "Loading new cnid2 database ..." 63 | ${DBLOADNEW} -f cnid2.dump cnid2.db 64 | 65 | echo 66 | echo "------------------------------------------------------------------" 67 | echo "Done." 68 | echo 69 | 70 | echo "Please now check the permissions of the cnid2.db file." 71 | echo "The cnid2.db must have the same uid:gid as the volume owner." 72 | 73 | exit 0 74 | -------------------------------------------------------------------------------- /debian/gbp.conf: -------------------------------------------------------------------------------- 1 | # Configuration file for git-buildpackage and friends 2 | 3 | [DEFAULT] 4 | pristine-tar = True 5 | sign-tags = True 6 | -------------------------------------------------------------------------------- /debian/libatalk-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/atalk/adouble.h 2 | usr/include/atalk/afp.h 3 | usr/include/atalk/vfs.h 4 | usr/include/atalk/cnid.h 5 | usr/include/atalk/logger.h 6 | usr/include/atalk/netatalk_conf.h 7 | usr/include/atalk/paths.h 8 | usr/include/atalk/unicode.h 9 | usr/include/atalk/util.h 10 | usr/include/atalk/ea.h 11 | usr/include/atalk/acl.h 12 | usr/include/atalk/unix.h 13 | usr/include/atalk/volume.h 14 | usr/include/atalk/standards.h 15 | usr/include/atalk/bstrlib.h 16 | usr/include/atalk/list.h 17 | usr/include/atalk/globals.h 18 | usr/include/atalk/compat.h 19 | usr/include/atalk/uam.h 20 | usr/include/atalk/iniparser.h 21 | usr/include/atalk/dictionary.h 22 | usr/include/atalk/hash.h 23 | usr/lib/libatalk.so 24 | usr/lib/libatalk.a 25 | usr/share/aclocal/netatalk.m4 26 | -------------------------------------------------------------------------------- /debian/libatalk18.install: -------------------------------------------------------------------------------- 1 | usr/lib/libatalk.so.18.0.0 2 | usr/lib/libatalk.so.18 3 | -------------------------------------------------------------------------------- /debian/netatalk.dirs: -------------------------------------------------------------------------------- 1 | etc/default 2 | etc/logcheck/ignore.d.server 3 | etc/logcheck/ignore.d.workstation 4 | etc/logcheck/violations.ignore.d 5 | var/spool/netatalk 6 | -------------------------------------------------------------------------------- /debian/netatalk.docs: -------------------------------------------------------------------------------- 1 | CONTRIBUTORS 2 | -------------------------------------------------------------------------------- /debian/netatalk.ignore: -------------------------------------------------------------------------------- 1 | usr/bin/add_netatalk_printer 2 | usr/bin/adv1tov2 3 | usr/bin/afpd-mtab.pl 4 | usr/bin/lp2pap.sh 5 | usr/bin/netatalkshorternamelinks.pl 6 | usr/include/netatalk/at.h 7 | -------------------------------------------------------------------------------- /debian/netatalk.install: -------------------------------------------------------------------------------- 1 | etc/pam.d/netatalk 2 | etc/netatalk/extmap.conf 3 | etc/netatalk/afp.conf 4 | usr/bin/ad 5 | usr/bin/afpldaptest 6 | usr/bin/afpstats 7 | usr/bin/apple_dump 8 | usr/bin/asip-status.pl 9 | usr/bin/cnid2_create 10 | usr/bin/dbd 11 | usr/bin/macusers 12 | usr/bin/netatalk-config 13 | usr/lib/netatalk/*.so 14 | usr/sbin/afpd 15 | usr/sbin/cnid_dbd 16 | usr/sbin/cnid_metad 17 | usr/sbin/netatalk 18 | usr/share/man/man1/ad.1 19 | usr/share/man/man1/afpldaptest.1 20 | usr/share/man/man1/afppasswd.1 21 | usr/share/man/man1/afpstats.1 22 | usr/share/man/man1/apple_dump.1 23 | usr/share/man/man1/asip-status.pl.1 24 | usr/share/man/man1/dbd.1 25 | usr/share/man/man1/macusers.1 26 | usr/share/man/man1/netatalk-config.1 27 | usr/share/man/man1/uniconv.1 28 | usr/share/man/man5/afp.conf.5 29 | usr/share/man/man5/afp_signature.conf.5 30 | usr/share/man/man5/afp_voluuid.conf.5 31 | usr/share/man/man5/extmap.conf.5 32 | usr/share/man/man8/afpd.8 33 | usr/share/man/man8/cnid_dbd.8 34 | usr/share/man/man8/cnid_metad.8 35 | usr/share/man/man8/netatalk.8 36 | var/lib/netatalk/ 37 | lib/systemd/system/netatalk.service 38 | -------------------------------------------------------------------------------- /debian/netatalk.logcheck.ignore.server: -------------------------------------------------------------------------------- 1 | afpd\[[0-9]+\]: ((dhx2?|cleartext|randnum/rand2num) )?login: [[:alnum:]]+$ 2 | afpd\[[0-9]+\]: (afp_flushfork|afp_read|getforkparms): (ad_refresh|of_find): (No such file or directory|No such process|Permission denied)$ 3 | afpd\[[0-9]+\]: dsi_stream_read\(0\): (No such file or directory|No such process|Permission denied)$ 4 | afpd\[[0-9]+\]: (atp_rresp|afp_die: asp_shutdown): Connection timed out$ 5 | afpd\[[0-9]+\]: (registering [[:alnum:]]+ \(uid [0-9]+\) on [\.0-9]+ as|removed) /[^[:space:]]+/net[\.0-9]+node[0-9]+$ 6 | afpd\[[0-9]+\]: (server_child\[[0-9]+\] [0-9]+ )?(done|exited 1)$ 7 | afpd\[[0-9]+\]: ASIP session:[0-9]+\([0-9]+\) from [\.:0-9]+\([0-9]+\)$ 8 | afpd\[[0-9]+\]: CNID DB initialized using Sleepycat Software: Berkeley DB( [\.0-9]+: \([^\(]+\))?$ 9 | afpd\[[0-9]+\]: Connection terminated$ 10 | afpd\[[0-9]+\]: [\.[:alnum:]]+ read, [\.[:alnum:]]+ written$ 11 | afpd\[[0-9]+\]: [_[:alnum:]]+(\(-?[0-9]+\))?: stat [^:]+: (No such file or directory|Permission denied)$ 12 | afpd\[[0-9]+\]: afp_alarm: child timed out$ 13 | atalkd\[[0-9]+\]: as_timer sendto: Network is unreachable $ 14 | afpd\[[0-9]+\]: asp_alrm: [0-9]+ timed out$ 15 | afpd\[[0-9]+\]: dsi_stream_(read\(-1\)|write): Connection reset by peer$ 16 | afpd\[[0-9]+\]: dsi_stream_read\(0\): Success$ 17 | afpd\[[0-9]+\]: error stat'ing /[^[:space:]]+/net[\.0-9]+node[0-9]+: No such file or directory$ 18 | afpd\[[0-9]+\]: login [[:alnum:]]+ \(uid [0-9]+, gid [0-9]+\)( AFP2\.2)?$ 19 | afpd\[[0-9]+\]: login noauth$ 20 | afpd\[[0-9]+\]: logout [[:alnum:]]+$ 21 | afpd\[[0-9]+\]: session from [\.:0-9]+ on [\.:0-9]+$ 22 | afpd\[[0-9]+\]: uams_dhx_pam.c :PAM: PAM (Auth OK!|Success -- Success)$ 23 | afpd\[[0-9]+\]: using codepage directory: /etc/netatalk/nls/maccode\.[\.a-z0-9-]+$ 24 | atalkd\[[0-9]+\]: zip (ignoring gnireply|gnireply from [\.0-9]+ \([[:alnum:]]+ [[:alnum:]]+\))$ 25 | atalkd\[[0-9]+\]: \[rtmp\.c:[0-9]+\]: I:ATalkDaemon: rtmp_replace [0-9]+-[0-9]+$ 26 | atalkd\[[0-9]+\]: \[rtmp\.c:[0-9]+\]: I:ATalkDaemon: rtmp_free [0-9]+-[0-9]+$ 27 | papd\[[0-9]+\]: child [0-9]+ done$ 28 | papd\[[0-9]+\]: child [0-9]+ for "[^[:space:]]+" from [\.0-9]+$ 29 | -------------------------------------------------------------------------------- /debian/netatalk.logcheck.violations.ignore: -------------------------------------------------------------------------------- 1 | afpd\[[0-9]+\]: afp_die: asp_shutdown: Connection timed out$ 2 | afpd\[[0-9]+\]: afp_getsrvrparms: stat /[^/]+/: Permission denied$ 3 | afpd\[[0-9]+\]: (afp_flushfork|afp_read|getforkparms): (ad_refresh|of_find): Permission denied$ 4 | afpd\[[0-9]+\]: dsi_stream_read\(0\): Permission denied$ 5 | -------------------------------------------------------------------------------- /debian/netatalk.logrotate: -------------------------------------------------------------------------------- 1 | /var/log/netatalk.log { 2 | rotate 14 3 | daily 4 | copytruncate 5 | compress 6 | delaycompress 7 | notifempty 8 | } 9 | -------------------------------------------------------------------------------- /debian/netatalk.pam: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | 3 | @include common-auth 4 | @include common-account 5 | @include common-password 6 | @include common-session 7 | -------------------------------------------------------------------------------- /debian/patches/101_start_avahi-daemon_before_atalkd.patch: -------------------------------------------------------------------------------- 1 | Description: Start avahi-daemon (if available) before atalkd 2 | Author: Jonas Smedegaard 3 | Last-Update: 2012-03-20 4 | 5 | --- a/distrib/initscripts/rc.atalk.debian.tmpl 6 | +++ b/distrib/initscripts/rc.atalk.debian.tmpl 7 | @@ -2,6 +2,7 @@ 8 | ### BEGIN INIT INFO 9 | # Provides: netatalk 10 | # Required-Start: $remote_fs $syslog 11 | +# Should-Start: avahi-daemon 12 | # Required-Stop: $remote_fs $syslog 13 | # Default-Start: 2 3 4 5 14 | # Default-Stop: 1 15 | -------------------------------------------------------------------------------- /debian/patches/114_fix_macusers_ps_parsing.patch: -------------------------------------------------------------------------------- 1 | Index: netatalk-debian/contrib/macusers/macusers.in 2 | =================================================================== 3 | --- netatalk-debian.orig/contrib/macusers/macusers.in 4 | +++ netatalk-debian/contrib/macusers/macusers.in 5 | @@ -124,7 +124,14 @@ while () { 6 | close(PFILES); 7 | } 8 | 9 | - ($t, $t, $uid, $t, $t, $t, $name, $t, $t) = getpwnam($user); 10 | + # Deal with truncated usernames. Caution: this does make the 11 | + # assumption that no username will be all-numeric. 12 | + if ($user =~ /^[0-9]+$/) { 13 | + $uid = $user; 14 | + ($user, $t, $t, $t, $t, $t, $name, $t, $t) = getpwuid($uid); 15 | + } else { 16 | + ($t, $t, $uid, $t, $t, $t, $name, $t, $t) = getpwnam($user); 17 | + } 18 | ($name) = ( $name =~ /(^[^,]+)/ ); 19 | printf "%-8d %-8d %-16s %-20s %-9s %s\n", $pid, $uid, $user, 20 | $name, $time, $mac{$pid}; 21 | -------------------------------------------------------------------------------- /debian/patches/201_etc2ps_paths.diff: -------------------------------------------------------------------------------- 1 | --- a/etc/psf/etc2ps.sh 2 | +++ b/etc/psf/etc2ps.sh 3 | @@ -9,11 +9,11 @@ 4 | # tag in the case. 5 | # 6 | 7 | -DVIPSPATH=/usr/local/tex/bin 8 | -DVIPS=/usr/local/tex/bin/dvips 9 | +DVIPSPATH=/usr/bin 10 | +DVIPS=/usr/bin/dvips 11 | DVIPSARGS="-f -q" 12 | 13 | -TROFF2PS=/usr/local/psroff/troff2/troff2ps 14 | +TROFF2PS=/usr/bin/roff2ps 15 | TROFF2PSARGS="-Z -O-.10" 16 | 17 | PATH=/usr/bin:$DVIPSPATH; export PATH 18 | -------------------------------------------------------------------------------- /debian/patches/202_psf_8_paths.diff: -------------------------------------------------------------------------------- 1 | --- a/man/man8/psf.8.tmpl 2 | +++ b/man/man8/psf.8.tmpl 3 | @@ -81,9 +81,9 @@ 4 | .\} 5 | .nf 6 | laser|lp|LaserWriter Plus on AppleTalk:\e 7 | - :sd=/usr/spool/lpd/laser:\e 8 | - :lp=/usr/spool/lpd/laser/null:\e 9 | - :lf=/var/adm/lpd\-errs:pw#80:hl:\e 10 | + :sd=/var/spool/lpd/laser:\e 11 | + :lp=/var/spool/lpd/laser/null:\e 12 | + :lf=/var/log/lpd\-errs:pw#80:hl:\e 13 | :of=:LIBEXECDIR:/ofpap:\e 14 | :if=:LIBEXECDIR:/ifpaprev:\e 15 | :tf=:LIBEXECDIR:/tfpaprev:\e 16 | -------------------------------------------------------------------------------- /debian/patches/205_applevolumes_default_homedir.diff: -------------------------------------------------------------------------------- 1 | --- a/config/AppleVolumes.default.tmpl 2 | +++ b/config/AppleVolumes.default.tmpl 3 | @@ -1,8 +1,3 @@ 4 | -# This file looks empty when viewed with "vi". In fact, there is one 5 | -# '~', so users with no AppleVolumes file in their home directory get 6 | -# their home directory by default. 7 | - 8 | -# 9 | # volume format: 10 | # :DEFAULT: [all of the default options except volume name] 11 | # path [name] [casefold:x] [options:z,l,j] \ 12 | @@ -178,9 +173,7 @@ 13 | # The line below sets some DEFAULT, starting with Netatalk 2.1. 14 | :DEFAULT: options:upriv,usedots 15 | 16 | -# The "~" below indicates that Home directories are visible by default. 17 | -# If you do not wish to have people accessing their Home directories, 18 | -# please put a pound sign in front of the tilde or delete it. 19 | -~ 20 | +# By default all users have access to their home directories. 21 | +~/ "Home Directory" 22 | 23 | # End of File 24 | -------------------------------------------------------------------------------- /debian/patches/402_init_lsb.patch: -------------------------------------------------------------------------------- 1 | From: Adrian Knoth 2 | Description: Source init-functions in init.d-script 3 | Forwarded: no 4 | Last-Update: 2014-01-28 5 | --- a/distrib/initscripts/rc.debian.tmpl 6 | +++ b/distrib/initscripts/rc.debian.tmpl 7 | @@ -13,6 +13,8 @@ 8 | 9 | set -e 10 | 11 | +. /lib/lsb/init-functions 12 | + 13 | PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 14 | DESC="Netatalk" 15 | NAME=netatalk 16 | -------------------------------------------------------------------------------- /debian/patches/README: -------------------------------------------------------------------------------- 1 | 0xx: Backports from newer upstream CVS. 2 | 1xx: Possibly relevant for upstream adoption. 3 | 2xx: Only relevant for official Debian release. 4 | -------------------------------------------------------------------------------- /debian/patches/series: -------------------------------------------------------------------------------- 1 | 114_fix_macusers_ps_parsing.patch 2 | 402_init_lsb.patch 3 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /debian/source/options: -------------------------------------------------------------------------------- 1 | extend-diff-ignore = "^\.travis\.yml$" 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | # Run the "uscan" command to check for upstream updates and more. 2 | version=3 3 | # use qa.debian.org redirector; see man uscan 4 | opts=dversionmangle=s/~(alpha|beta|rc)/-$1/ \ 5 | http://sf.net/netatalk/netatalk-(\d.*)\.tar\.gz debian 6 | -------------------------------------------------------------------------------- /distrib/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for distrib/ 2 | 3 | SUBDIRS = config initscripts m4 4 | -------------------------------------------------------------------------------- /distrib/config/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile for distrib/config/ 2 | 3 | bin_SCRIPTS = netatalk-config 4 | -------------------------------------------------------------------------------- /distrib/initscripts/netatalk.xml.tmpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /distrib/initscripts/rc.bsd.tmpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Netatalk :NETATALK_VERSION: daemons. 4 | # 5 | 6 | echo -n 'starting netatalk daemons:' 7 | 8 | if [ -x :SBINDIR:/netatalk ]; then 9 | :SBINDIR:/netatalk 10 | echo -n ' netatalk' 11 | fi 12 | 13 | echo '.' 14 | -------------------------------------------------------------------------------- /distrib/initscripts/rc.gentoo.tmpl: -------------------------------------------------------------------------------- 1 | #!/sbin/openrc-run 2 | # Copyright 1999-2012 Gentoo Foundation 3 | # Distributed under the terms of the GNU General Public License v2 4 | # 5 | # Netatalk :NETATALK_VERSION: daemons. 6 | 7 | command=":SBINDIR:/${SVCNAME}" 8 | 9 | depend() { 10 | need net 11 | use avahi-daemon 12 | use logger dns 13 | after entropy 14 | } 15 | -------------------------------------------------------------------------------- /distrib/initscripts/rc.netbsd.tmpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # PROVIDE: netatalk 4 | # KEYWORD: shutdown 5 | # 6 | # AFP fileserver for Macintosh clients (netatalk :NETATALK_VERSION:) 7 | # 8 | 9 | . /etc/rc.subr 10 | 11 | name="netatalk" 12 | rcvar=$name 13 | command=":SBINDIR:/netatalk" 14 | etcdir=":ETCDIR:" 15 | pidfile="/var/run/${name}.pid" 16 | required_files="$etcdir/afp.conf" 17 | 18 | load_rc_config $name 19 | run_rc_command "$1" 20 | -------------------------------------------------------------------------------- /distrib/initscripts/rc.solaris.tmpl: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Start/stop the Netatalk :NETATALK_VERSION: daemons. 4 | # 5 | 6 | # 7 | # kill the named process(es) 8 | # 9 | killproc() { 10 | pid=`/usr/bin/ps -e | 11 | /usr/bin/grep $1 | 12 | /usr/bin/sed -e 's/^ *//' -e 's/ .*//'` 13 | [ "$pid" != "" ] && kill $pid 14 | } 15 | 16 | # 17 | # Start the netatalk server processes. 18 | # 19 | 20 | netatalk_startup() { 21 | echo 'starting netatalk daemons: \c' 22 | 23 | if [ -x :SBINDIR:/netatalk ]; then 24 | :SBINDIR:/netatalk 25 | echo ' netatalk\c' 26 | fi 27 | 28 | echo '.' 29 | } 30 | 31 | 32 | case "$1" in 33 | 34 | 'start') 35 | netatalk_startup 36 | ;; 37 | 38 | # 39 | # Stop the netatalk server processes. 40 | # 41 | 'stop') 42 | 43 | echo 'stopping netatalk daemons:\c' 44 | 45 | if [ -x :SBINDIR:/netatalk ]; then 46 | killproc netatalk; echo ' netatalk\c' 47 | fi 48 | 49 | echo '.' 50 | ;; 51 | 52 | # 53 | # Usage statement. 54 | # 55 | 56 | *) 57 | echo "usage: $0 {start|stop}" 58 | exit 1 59 | ;; 60 | esac 61 | -------------------------------------------------------------------------------- /distrib/initscripts/rc.suse.tmpl: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | ### BEGIN INIT INFO 3 | # Provides: netatalk 4 | # Required-Start: $local_fs 5 | # Required-Stop: $local_fs 6 | # Should-Start: $network $named $remote_fs $syslog avahi-daemon 7 | # Should-Stop: $remote_fs $network $syslog 8 | # Default-Start: 3 5 9 | # Default-Stop: 10 | # Description: Netatalk AFP fileserver for Macintosh clients 11 | ### END INIT INFO 12 | 13 | # Netatalk :NETATALK_VERSION: 14 | 15 | . /etc/rc.status 16 | 17 | # startup code for everything 18 | netatalk_startup() { 19 | if [ -x :SBINDIR:/netatalk ] ; then 20 | echo -n " Starting netatalk " 21 | startproc :SBINDIR:/netatalk 22 | rc_status -v 23 | fi 24 | 25 | touch /var/lock/subsys/netatalk 26 | } 27 | 28 | case "$1" in 29 | start) 30 | if test ! -z "$UID" -a "$UID" != 0 ; then 31 | echo "you have to be root to start netatalk daemons" 32 | rc_failed 33 | else 34 | echo "Starting netatalk..." 35 | netatalk_startup 36 | fi 37 | ;; 38 | stop) 39 | echo -n "Shutting down netatalk" 40 | killproc -TERM :SBINDIR:/netatalk 41 | rc_status -v 42 | ;; 43 | restart|reload|force-reload) 44 | $0 stop 45 | $0 start 46 | rc_status 47 | ;; 48 | status) 49 | echo "Checking for netatalk services" 50 | checkproc :SBINDIR:/netatalk && echo "netatalk: OK" || echo "netatalk: No process" 51 | checkproc :SBINDIR:/netatalk 52 | rc_status -v 53 | ;; 54 | *) 55 | echo "Usage: $0 {start|stop|restart|status}" 56 | exit 1 57 | ;; 58 | esac 59 | 60 | rc_exit 61 | -------------------------------------------------------------------------------- /distrib/initscripts/service.systemd.tmpl: -------------------------------------------------------------------------------- 1 | # This file is part of netatalk :NETATALK_VERSION:. 2 | 3 | [Unit] 4 | Description=Netatalk AFP fileserver for Macintosh clients 5 | Documentation=man:afp.conf(5) man:netatalk(8) man:afpd(8) man:cnid_metad(8) man:cnid_dbd(8) 6 | Documentation=http://netatalk.sourceforge.net/ 7 | After=syslog.target network.target avahi-daemon.service 8 | 9 | [Service] 10 | Type=forking 11 | GuessMainPID=no 12 | ExecStart=:SBINDIR:/netatalk 13 | PIDFile=:PATH_NETATALK_LOCK: 14 | ExecReload=/bin/kill -HUP $MAINPID 15 | Restart=always 16 | RestartSec=1 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /distrib/m4/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile for distrib/m4/ 2 | 3 | m4datadir = $(datadir)/aclocal 4 | m4data_DATA = netatalk.m4 5 | 6 | EXTRA_DIST = $(m4data_DATA) 7 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = manpages manual 2 | 3 | DISTCLEANFILES = html.xsl man.xsl 4 | 5 | release-notes: www/ReleaseNotes 6 | cd www && ./create-relnotes.sh 7 | 8 | upload-release-notes: release-notes 9 | scp www/ReleaseNotes.html $$USER,netatalk@web.sourceforge.net:/home/project-web/netatalk/htdocs/3.1/ReleaseNotes$(VERSION).html 10 | -------------------------------------------------------------------------------- /doc/html.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /doc/man.xsl.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 1 7 | 8 | (//refmiscinfo[@class='date'])[last()] 9 | 10 | 11 | 12 | 1 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/manpages/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = man1 man5 man8 -------------------------------------------------------------------------------- /doc/manpages/man1/Makefile.am: -------------------------------------------------------------------------------- 1 | XSLTPROC=@XSLTPROC@ 2 | XSLTPROC_FLAGS=@XSLTPROC_FLAGS@ 3 | MAN_STYLESHEET=$(top_srcdir)/doc/man.xsl 4 | CLEANFILES = 5 | 6 | MAN_MANPAGES = \ 7 | ad.1 \ 8 | afpldaptest.1 \ 9 | afppasswd.1 \ 10 | afpstats.1 \ 11 | apple_dump.1 \ 12 | asip-status.pl.1 \ 13 | dbd.1 \ 14 | macusers.1 \ 15 | megatron.1 \ 16 | netatalk-config.1 \ 17 | uniconv.1 18 | 19 | EXTRA_DIST = \ 20 | ad.1.xml \ 21 | afpldaptest.1.xml \ 22 | afppasswd.1.xml \ 23 | afpstats.1.xml \ 24 | apple_dump.1.xml \ 25 | asip-status.pl.1.xml \ 26 | dbd.1.xml \ 27 | macusers.1.xml \ 28 | megatron.1.xml \ 29 | netatalk-config.1.xml \ 30 | uniconv.1.xml 31 | 32 | if HAVE_XSLTPROC 33 | CLEANFILES += $(MAN_MANPAGES) 34 | 35 | %.1 : %.1.xml 36 | @xsltproc $(MAN_STYLESHEET) $< 37 | @cp $@ $(top_builddir)/man/man1/$@.in 38 | 39 | html-local: $(MAN_MANPAGES) $(MAN_STYLESHEET) 40 | endif 41 | -------------------------------------------------------------------------------- /doc/manpages/man1/afpstats.1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | afpstats 5 | 6 | 1 7 | 8 | 24 Mar 2013 9 | 10 | @NETATALK_VERSION@ 11 | 12 | 13 | 14 | afpstats 15 | 16 | List AFP statistics 17 | 18 | 19 | 20 | 21 | afpstats 22 | 23 | 24 | 25 | 26 | DESCRIPTION 27 | 28 | afpstats list AFP statistics via D-Bus IPC. 29 | 30 | 31 | 32 | 33 | NOTE 34 | 35 | afpd must support D-Bus. Check it by 36 | "afpd -V". 37 | 38 | "" must be set in 39 | @pkgconfdir@/afp.conf. 40 | 41 | 42 | 43 | 44 | SEE ALSO 45 | 46 | afpd8, 47 | afp.conf5, 48 | dbus-daemon1 49 | 50 | 51 | -------------------------------------------------------------------------------- /doc/manpages/man1/macusers.1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | macusers 5 | 6 | 1 7 | 8 | 13 Oct 2011 9 | 10 | @NETATALK_VERSION@ 11 | 12 | 13 | 14 | macusers 15 | 16 | List the users connecting via AFP 17 | 18 | 19 | 20 | 21 | macusers 22 | 23 | 24 | 25 | macusers 26 | 27 | 28 | -v 29 | -version 30 | --version 31 | -h 32 | -help 33 | --help 34 | 35 | 36 | 37 | 38 | 39 | 40 | DESCRIPTION 41 | 42 | macusers list the users connecting via AFP. 43 | 44 | 45 | 46 | 47 | OPTIONS 48 | 49 | 50 | 51 | 52 | 53 | 54 | Show version and exit 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Display the help and exit 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | SEE ALSO 72 | 73 | afpd8 74 | 75 | 76 | -------------------------------------------------------------------------------- /doc/manpages/man5/Makefile.am: -------------------------------------------------------------------------------- 1 | XSLTPROC=@XSLTPROC@ 2 | XSLTPROC_FLAGS=@XSLTPROC_FLAGS@ 3 | MAN_STYLESHEET=$(top_srcdir)/doc/man.xsl 4 | CLEANFILES = 5 | 6 | MAN_MANPAGES = \ 7 | afp.conf.5 \ 8 | afp_signature.conf.5 \ 9 | afp_voluuid.conf.5 \ 10 | extmap.conf.5 11 | 12 | EXTRA_DIST = \ 13 | afp_signature.conf.5.xml \ 14 | afp_voluuid.conf.5.xml \ 15 | afp.conf.5.xml \ 16 | extmap.conf.5.xml 17 | 18 | if HAVE_XSLTPROC 19 | CLEANFILES += $(MAN_MANPAGES) 20 | 21 | %.5 : %.5.xml 22 | @xsltproc $(MAN_STYLESHEET) $< 23 | @cp $@ $(top_builddir)/man/man5/$@.in 24 | 25 | html-local: $(MAN_MANPAGES) $(MAN_STYLESHEET) 26 | endif -------------------------------------------------------------------------------- /doc/manpages/man8/Makefile.am: -------------------------------------------------------------------------------- 1 | XSLTPROC=@XSLTPROC@ 2 | XSLTPROC_FLAGS=@XSLTPROC_FLAGS@ 3 | MAN_STYLESHEET=$(top_srcdir)/doc/man.xsl 4 | CLEANFILES = 5 | 6 | MAN_MANPAGES = \ 7 | afpd.8 \ 8 | cnid_dbd.8 \ 9 | cnid_metad.8 \ 10 | netatalk.8 11 | 12 | EXTRA_DIST = \ 13 | afpd.8.xml \ 14 | cnid_dbd.8.xml \ 15 | cnid_metad.8.xml \ 16 | netatalk.8.xml 17 | 18 | if HAVE_XSLTPROC 19 | CLEANFILES += $(MAN_MANPAGES) 20 | 21 | %.8 : %.8.xml 22 | @xsltproc $(MAN_STYLESHEET) $< 23 | @cp $@ $(top_builddir)/man/man8/$@.in 24 | 25 | html-local: $(MAN_MANPAGES) $(MAN_STYLESHEET) 26 | endif -------------------------------------------------------------------------------- /doc/manual/Makefile.am: -------------------------------------------------------------------------------- 1 | XSLTPROC=@XSLTPROC@ 2 | XSLTPROC_FLAGS=@XSLTPROC_FLAGS@ 3 | HTML_STYLESHEET=$(top_srcdir)/doc/html.xsl 4 | CLEANFILES = 5 | 6 | XML_PAGES = \ 7 | manual.xml \ 8 | configuration.xml \ 9 | install.xml \ 10 | intro.xml \ 11 | upgrade.xml 12 | 13 | EXTRA_DIST = \ 14 | manual.xml.in \ 15 | configuration.xml \ 16 | install.xml \ 17 | intro.xml \ 18 | upgrade.xml \ 19 | netatalk.html 20 | 21 | HTML_PAGES = \ 22 | ad.1.html \ 23 | afp.conf.5.html \ 24 | afpd.8.html \ 25 | afpldaptest.1.html \ 26 | afppasswd.1.html \ 27 | afp_signature.conf.5.html \ 28 | afpstats.1.html \ 29 | afp_voluuid.conf.5.html \ 30 | apple_dump.1.html \ 31 | asip-status.pl.1.html \ 32 | cnid_dbd.8.html \ 33 | cnid_metad.8.html \ 34 | configuration.html \ 35 | dbd.1.html \ 36 | example-toc.html \ 37 | extmap.conf.5.html \ 38 | index.html \ 39 | installation.html \ 40 | intro.html \ 41 | macusers.1.html \ 42 | man-pages.html \ 43 | manual-index.html \ 44 | megatron.1.html \ 45 | netatalk.8.html \ 46 | netatalkconfig.1.html \ 47 | pr01.html \ 48 | table-toc.html \ 49 | uniconv.1.html \ 50 | upgrade.html 51 | 52 | DISTCLEANFILES = manual.xml 53 | 54 | if HAVE_XSLTPROC 55 | CLEANFILES += $(HTML_PAGES) 56 | 57 | html-local: $(XML_PAGES) 58 | @xsltproc $(HTML_STYLESHEET) manual.xml 59 | 60 | html-upload: html-local 61 | scp $(HTML_PAGES) $$USER,netatalk@web.sourceforge.net:/home/project-web/netatalk/htdocs/3.1/htmldocs/ 62 | 63 | endif 64 | -------------------------------------------------------------------------------- /doc/manual/intro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Introduction to Netatalk 4 | 5 | Netatalk is an OpenSource software package, that can be used to turn 6 | a *NIX machine into an extremely high-performance and 7 | reliable file server for Macintosh computers. 8 | 9 | Using Netatalk's AFP 3.3 compliant file-server leads to significantly 10 | higher transmission speeds compared with Macs accessing a server via 11 | SaMBa/NFS while providing clients with the best possible user experience 12 | (full support for Macintosh metadata, flawlessly supporting mixed 13 | environments of classic Mac OS and OS X clients) 14 | 15 | 16 | -------------------------------------------------------------------------------- /doc/manual/netatalk.html: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | -------------------------------------------------------------------------------- /etc/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for etc/ 2 | 3 | SUBDIRS = spotlight afpd cnid_dbd netatalk uams 4 | -------------------------------------------------------------------------------- /etc/afpd/afp_config.h: -------------------------------------------------------------------------------- 1 | #ifndef AFPD_CONFIG_H 2 | #define AFPD_CONFIG_H 1 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern int configinit (AFPObj *); 9 | extern void configfree (AFPObj *, DSI *); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /etc/afpd/afpstats-service.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /etc/afpd/afpstats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Frank Lahm 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef AFPD_AFPSTATS_H 16 | #define AFPD_AFPSTATS_H 17 | 18 | #include 19 | 20 | extern int afpstats_init(server_child_t *); 21 | extern server_child_t *afpstats_get_and_lock_childs(void); 22 | extern void afpstats_unlock_childs(void); 23 | #endif 24 | -------------------------------------------------------------------------------- /etc/afpd/afpstats_obj.h: -------------------------------------------------------------------------------- 1 | #ifndef AFPSTATS_OBJ_H 2 | #define AFPSTATS_OBJ_H 3 | 4 | #include 5 | 6 | typedef struct AFPStatsObj AFPStatsObj; 7 | typedef struct AFPStatsObjClass AFPStatsObjClass; 8 | 9 | GType afpstats_obj_get_type(void); 10 | gboolean afpstats_obj_get_users(AFPStatsObj *obj, gchar ***ret, GError **error); 11 | 12 | #define AFPSTATS_TYPE_OBJECT (afpstats_obj_get_type ()) 13 | #define AFPSTATS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST((object), AFPSTATS_TYPE_OBJECT, AFPStatsObj)) 14 | #define AFPSTATS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), AFPSTATS_TYPE_OBJECT, AFPStatsObjClass)) 15 | #define AFPSTATS_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), AFPSTATS_TYPE_OBJECT)) 16 | #define AFPSTATS_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), AFPSTATS_TYPE_OBJECT)) 17 | #define AFPSTATS_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AFPSTATS_TYPE_OBJECT, AFPStatsObjClass)) 18 | 19 | #endif /* AFPSTATS_OBJ_H */ 20 | -------------------------------------------------------------------------------- /etc/afpd/auth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1990,1993 Regents of The University of Michigan. 3 | * All Rights Reserved. See COPYRIGHT. 4 | */ 5 | 6 | #ifndef AFPD_AUTH_H 7 | #define AFPD_AUTH_H 1 8 | 9 | #include 10 | 11 | #include 12 | 13 | struct afp_versions { 14 | char *av_name; 15 | int av_number; 16 | }; 17 | 18 | static const struct afp_versions afp_versions[] = { 19 | { "AFP2.2", 22 }, 20 | { "AFPX03", 30 }, 21 | { "AFP3.1", 31 }, 22 | { "AFP3.2", 32 }, 23 | { "AFP3.3", 33 }, 24 | { "AFP3.4", 34 } 25 | }; 26 | 27 | /* for GetUserInfo */ 28 | #define USERIBIT_USER (1 << 0) 29 | #define USERIBIT_GROUP (1 << 1) 30 | #define USERIBIT_UUID (1 << 2) 31 | #define USERIBIT_ALL (USERIBIT_USER | USERIBIT_GROUP | USERIBIT_UUID) 32 | 33 | extern uid_t uuid; 34 | #if defined( sun ) && !defined( __svr4__ ) || defined( ultrix ) 35 | extern int *groups; 36 | #else /*sun __svr4__ ultrix*/ 37 | extern gid_t *groups; 38 | #endif /*sun __svr4__ ultrix*/ 39 | extern int ngroups; 40 | 41 | /* FP functions */ 42 | int afp_login (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 43 | int afp_login_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 44 | int afp_logincont (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 45 | int afp_changepw (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 46 | int afp_logout (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 47 | int afp_getuserinfo (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 48 | int afp_getsession (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 49 | int afp_disconnect (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 50 | int afp_zzz (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 51 | 52 | #endif /* auth.h */ 53 | -------------------------------------------------------------------------------- /etc/afpd/dircache.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef DIRCACHE_H 16 | #define DIRCACHE_H 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | /* Maximum size of the dircache hashtable */ 24 | #define MAX_POSSIBLE_DIRCACHE_SIZE 131072 25 | #define DIRCACHE_FREE_QUANTUM 256 26 | 27 | /* flags for dircache_remove */ 28 | #define DIRCACHE (1 << 0) 29 | #define DIDNAME_INDEX (1 << 1) 30 | #define QUEUE_INDEX (1 << 2) 31 | #define DIRCACHE_ALL (DIRCACHE|DIDNAME_INDEX|QUEUE_INDEX) 32 | 33 | extern int dircache_init(int reqsize); 34 | extern int dircache_add(const struct vol *, struct dir *); 35 | extern void dircache_remove(const struct vol *, struct dir *, int flag); 36 | extern struct dir *dircache_search_by_did(const struct vol *vol, cnid_t did); 37 | extern struct dir *dircache_search_by_name(const struct vol *, const struct dir *dir, char *name, int len); 38 | extern void dircache_dump(void); 39 | extern void log_dircache_stat(void); 40 | #endif /* DIRCACHE_H */ 41 | -------------------------------------------------------------------------------- /etc/afpd/extattrs.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef AFPD_EXT_ATTRS_H 16 | #define AFPD_EXT_ATTRS_H 17 | 18 | /* AFP funcs */ 19 | int afp_listextattr (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 20 | int afp_getextattr (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 21 | int afp_setextattr(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 22 | int afp_remextattr(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 23 | 24 | #endif /* AFPD_EXT_ATTRS_H */ 25 | -------------------------------------------------------------------------------- /etc/afpd/fce_api_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: fce_api_internal.h 3 | * Author: mw 4 | * 5 | * Created on 1. Oktober 2010, 23:48 6 | */ 7 | 8 | #ifndef _FCE_API_INTERNAL_H 9 | #define _FCE_API_INTERNAL_H 10 | 11 | #include 12 | 13 | #include 14 | 15 | #define FCE_MAX_UDP_SOCKS 5 /* Allow a maximum of udp listeners for file change events */ 16 | #define FCE_SOCKET_RETRY_DELAY_S 600 /* Pause this time in s after socket was broken */ 17 | #define FCE_HISTORY_LEN 10 /* This is used to coalesce events */ 18 | #define MAX_COALESCE_TIME_MS 1000 /* Events oldeer than this are not coalesced */ 19 | 20 | #define FCE_COALESCE_CREATE (1 << 0) 21 | #define FCE_COALESCE_DELETE (1 << 1) 22 | #define FCE_COALESCE_ALL (FCE_COALESCE_CREATE | FCE_COALESCE_DELETE) 23 | 24 | struct udp_entry { 25 | int sock; 26 | char *addr; 27 | char *port; 28 | struct addrinfo addrinfo; 29 | struct sockaddr_storage sockaddr; 30 | time_t next_try_on_error; /* In case of error set next timestamp to retry */ 31 | }; 32 | 33 | struct fce_history { 34 | fce_ev_t fce_h_event; 35 | char fce_h_path[MAXPATHLEN + 1]; 36 | struct timeval fce_h_tv; 37 | }; 38 | 39 | struct fce_close_event { 40 | time_t time; 41 | char path[MAXPATHLEN + 1]; 42 | }; 43 | 44 | #define PACKET_HDR_LEN (sizeof(struct fce_packet) - FCE_MAX_PATH_LEN) 45 | 46 | bool fce_handle_coalescation(int event, const char *path); 47 | void fce_initialize_history(); 48 | 49 | 50 | #endif /* _FCE_API_INTERNAL_H */ 51 | 52 | -------------------------------------------------------------------------------- /etc/afpd/filedir.h: -------------------------------------------------------------------------------- 1 | #ifndef AFPD_FILEDIR_H 2 | #define AFPD_FILEDIR_H 1 3 | 4 | #include 5 | #include 6 | #include "volume.h" 7 | 8 | extern struct afp_options default_options; 9 | 10 | extern char *ctoupath (const struct vol *, struct dir *, 11 | char *); 12 | extern char *absupath (const struct vol *, struct dir *, 13 | char *); 14 | extern int veto_file (const char *veto_str, const char *path); 15 | extern int check_name (const struct vol *vol, char *name); 16 | 17 | extern int matchfile2dirperms (char *, struct vol *, int); 18 | extern int delete_vetoed_files(struct vol *vol, const char *upath, bool in_vetodir); 19 | 20 | /* FP functions */ 21 | int afp_moveandrename (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 22 | int afp_rename (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 23 | int afp_delete (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 24 | int afp_getfildirparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 25 | int afp_setfildirparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /etc/afpd/icon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1990,1994 Regents of The University of Michigan. 3 | * All Rights Reserved. See COPYRIGHT. 4 | */ 5 | 6 | #ifndef AFPD_ICON_H 7 | #define AFPD_ICON_H 1 8 | 9 | #include 10 | 11 | static const unsigned char icon[] = { /* daemon */ 12 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x2, 0x0, 13 | 0x1, 0x80, 0x3, 0x0, 0x2, 0x80, 0x2, 0x80, 14 | 0x2, 0x80, 0x2, 0x80, 0x4, 0x80, 0x2, 0x40, 15 | 0x4, 0x87, 0xC2, 0x40, 0x4, 0x58, 0x34, 0x40, 16 | 0x4, 0x20, 0x8, 0x40, 0x2, 0x16, 0xD0, 0x80, 17 | 0x1, 0x1, 0x1, 0x0, 0x2, 0x80, 0x2, 0x80, 18 | 0x2, 0x9C, 0x72, 0x80, 0x4, 0x22, 0x88, 0x40, 19 | 0x4, 0x41, 0x4, 0x40, 0x4, 0x41, 0x4, 0x40, 20 | 0x4, 0x41, 0x4, 0x40, 0x4, 0x49, 0x24, 0x40, 21 | 0xE, 0x55, 0x54, 0xE0, 0x10, 0x5D, 0x74, 0x10, 22 | 0x10, 0x3E, 0xF8, 0x10, 0x7F, 0xFC, 0x7F, 0xFE, 23 | 0x20, 0x4, 0x40, 0x4, 0x1F, 0xFC, 0x7F, 0xF8, 24 | 0x0, 0x7, 0xC0, 0x0, 0x0, 0x4, 0x40, 0x0, 25 | 0x0, 0x3, 0x80, 0x0, 0x0, 0x4, 0x40, 0x0, 26 | 0xAF, 0xF9, 0x3F, 0xF5, 0x0, 0x2, 0x80, 0x0, 27 | 0xAF, 0xFC, 0x7F, 0xF5, 0x0, 0x0, 0x0, 0x0, 28 | 0x0, 0x0, 0x0, 0x0, 0x0, 0x80, 0x2, 0x0, 29 | 0x1, 0x80, 0x3, 0x0, 0x3, 0x80, 0x3, 0x80, 30 | 0x3, 0x80, 0x3, 0x80, 0x7, 0x80, 0x3, 0xC0, 31 | 0x7, 0x87, 0xC3, 0xC0, 0x7, 0xDF, 0xF7, 0xC0, 32 | 0x7, 0xFF, 0xFF, 0xC0, 0x3, 0xFF, 0xFF, 0x80, 33 | 0x1, 0xFF, 0xFF, 0x0, 0x3, 0xFF, 0xFF, 0x80, 34 | 0x3, 0xFF, 0xFF, 0x80, 0x7, 0xFF, 0xFF, 0xC0, 35 | 0x7, 0xFF, 0xFF, 0xC0, 0x7, 0xFF, 0xFF, 0xC0, 36 | 0x7, 0xFF, 0xFF, 0xC0, 0x7, 0xFF, 0xFF, 0xC0, 37 | 0xF, 0xFF, 0xFF, 0xE0, 0x1F, 0xFF, 0xFF, 0xF0, 38 | 0x1F, 0xFF, 0xFF, 0xF0, 0x7F, 0xFF, 0xFF, 0xFE, 39 | 0x3F, 0xFF, 0xFF, 0xFC, 0x1F, 0xFF, 0xFF, 0xF8, 40 | 0x0, 0x7, 0xC0, 0x0, 0x0, 0x7, 0xC0, 0x0, 41 | 0x0, 0x3, 0x80, 0x0, 0x0, 0x4, 0x40, 0x0, 42 | 0xAF, 0xF9, 0x3F, 0xF5, 0x0, 0x2, 0x80, 0x0, 43 | 0xAF, 0xFC, 0x7F, 0xF5, 0x0, 0x0, 0x0, 0x0 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /etc/afpd/mangle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | */ 4 | 5 | #ifndef AFPD_MANGLE_H 6 | #define AFPD_MANGLE_H 1 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include "volume.h" 18 | #include "directory.h" 19 | 20 | #define MANGLE_CHAR '#' 21 | #define MAX_MANGLE_SUFFIX_LENGTH 999 22 | #define MAX_EXT_LENGTH 5 /* XXX This cannot be greater than 27 */ 23 | #define MANGLE_LENGTH 9 /* #ffffffff This really can't be changed. */ 24 | #define MAX_LENGTH MACFILELEN 25 | 26 | extern char *mangle (const struct vol *, char *, size_t, char *, cnid_t, int); 27 | extern char *demangle (const struct vol *, char *, cnid_t did); 28 | extern char *demangle_osx (const struct vol *, char *, cnid_t did, cnid_t *fileid); 29 | 30 | #endif /* AFPD_MANGLE_H */ 31 | -------------------------------------------------------------------------------- /etc/afpd/misc.h: -------------------------------------------------------------------------------- 1 | #ifndef AFPD_MISC_H 2 | #define AFPD_MISC_H 1 3 | 4 | #include 5 | 6 | /* FP functions */ 7 | /* messages.c */ 8 | int afp_getsrvrmesg (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 9 | 10 | /* afs.c */ 11 | #ifdef AFS 12 | int afp_getdiracl (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 13 | int afp_setdiracl (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 14 | #else /* AFS */ 15 | #define afp_getdiracl NULL 16 | #define afp_setdiracl NULL 17 | #endif /* AFS */ 18 | 19 | #if defined( AFS ) && defined( UAM_AFSKRB ) 20 | int afp_afschangepw (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 21 | #else /* AFS && UAM_AFSKRB */ 22 | #define afp_afschangepw NULL 23 | #endif /* AFS && UAM_AFSKRB */ 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /etc/afpd/status.h: -------------------------------------------------------------------------------- 1 | #ifndef AFPD_STATUS_H 2 | #define AFPD_STATUS_H 1 3 | 4 | #include 5 | #include 6 | 7 | #include "afp_config.h" 8 | 9 | /* we use these to prevent whacky alignment problems */ 10 | #define AFPSTATUS_MACHOFF 0 11 | #define AFPSTATUS_VERSOFF 2 12 | #define AFPSTATUS_UAMSOFF 4 13 | #define AFPSTATUS_ICONOFF 6 14 | #define AFPSTATUS_FLAGOFF 8 15 | 16 | /* AFPSTATUS_PRELEN is the number of bytes for status data prior to 17 | * the ServerName field. 18 | * 19 | * This is two bytes of offset space for the MachineType, AFPVersionCount, 20 | * UAMCount, VolumeIconAndMask, and the 16-bit "Fixed" status flags. 21 | */ 22 | #define AFPSTATUS_PRELEN 10 23 | 24 | /* AFPSTATUS_POSTLEN is the number of bytes for offset records 25 | * after the ServerName field. 26 | * 27 | * Right now, this is 2 bytes each for ServerSignature, networkAddressCount, 28 | * DirectoryNameCount, and UTF-8 ServerName 29 | */ 30 | #define AFPSTATUS_POSTLEN 8 31 | #define AFPSTATUS_LEN (AFPSTATUS_PRELEN + AFPSTATUS_POSTLEN) 32 | 33 | /* AFPSTATUS_MACHLEN is the number of characters for the MachineType. */ 34 | #define AFPSTATUS_MACHLEN 16 35 | 36 | extern void status_versions (char * /*status*/, const DSI *); 37 | extern void status_uams (char * /*status*/, const char * /*authlist*/); 38 | extern void status_init (AFPObj *, DSI *dsi); 39 | extern void set_signature(struct afp_options *); 40 | 41 | /* FP functions */ 42 | int afp_getsrvrinfo (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /etc/afpd/switch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1990,1991 Regents of The University of Michigan. 4 | * All Rights Reserved. 5 | * 6 | * Permission to use, copy, modify, and distribute this software and 7 | * its documentation for any purpose and without fee is hereby granted, 8 | * provided that the above copyright notice appears in all copies and 9 | * that both that copyright notice and this permission notice appear 10 | * in supporting documentation, and that the name of The University 11 | * of Michigan not be used in advertising or publicity pertaining to 12 | * distribution of the software without specific, written prior 13 | * permission. This software is supplied as is without expressed or 14 | * implied warranties of any kind. 15 | * 16 | * Research Systems Unix Group 17 | * The University of Michigan 18 | * c/o Mike Clark 19 | * 535 W. William Street 20 | * Ann Arbor, Michigan 21 | * +1-313-763-0525 22 | * netatalk@itd.umich.edu 23 | */ 24 | 25 | #ifndef AFPD_SWITCH_H 26 | #define AFPD_SWITCH_H 1 27 | 28 | extern AFPCmd *afp_switch; 29 | extern AFPCmd postauth_switch[]; 30 | 31 | /* switch.c */ 32 | #define UAM_AFPSERVER_PREAUTH (0) 33 | #define UAM_AFPSERVER_POSTAUTH (1 << 0) 34 | 35 | extern int uam_afpserver_action (const int /*id*/, const int /*switch*/, 36 | AFPCmd new_table, AFPCmd *old); 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /etc/afpd/uid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * code: jeff@univrel.pr.uconn.edu 3 | * 4 | * These functions are abstracted here, so that all calls for resolving 5 | * user/group names can be centrally changed (good for OS dependant calls 6 | * across the package). 7 | */ 8 | 9 | #ifdef HAVE_CONFIG_H 10 | #include "config.h" 11 | #endif /* HAVE_CONFIG_H */ 12 | 13 | -------------------------------------------------------------------------------- /etc/afpd/uid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * code: jeff@univrel.pr.uconn.edu 3 | */ 4 | 5 | #ifndef AFPD_UID_H 6 | #define AFPD_UID_H 1 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /etc/afpd/volume.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1990,1994 Regents of The University of Michigan. 3 | * All Rights Reserved. See COPYRIGHT. 4 | */ 5 | 6 | #ifndef AFPD_VOLUME_H 7 | #define AFPD_VOLUME_H 1 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | extern int ustatfs_getvolspace (const struct vol *, 18 | VolSpace *, VolSpace *, 19 | uint32_t *); 20 | extern void setvoltime (AFPObj *, struct vol *); 21 | extern int pollvoltime (AFPObj *); 22 | 23 | /* FP functions */ 24 | int afp_openvol (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 25 | int afp_getvolparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 26 | int afp_setvolparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 27 | int afp_getsrvrparms (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 28 | int afp_closevol (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); 29 | 30 | /* netatalk functions */ 31 | extern void close_all_vol(const AFPObj *obj); 32 | extern void closevol(const AFPObj *obj, struct vol *vol); 33 | #endif 34 | -------------------------------------------------------------------------------- /etc/cnid_dbd/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for etc/cnid_dbd/ 2 | 3 | if BUILD_DBD_DAEMON 4 | sbin_PROGRAMS = cnid_dbd cnid_metad 5 | bin_PROGRAMS = dbd 6 | else 7 | sbin_PROGRAMS = 8 | endif 9 | 10 | cnid_dbd_SOURCES = dbif.c pack.c comm.c db_param.c main.c \ 11 | dbd_add.c dbd_get.c dbd_resolve.c dbd_lookup.c \ 12 | dbd_update.c dbd_delete.c dbd_getstamp.c \ 13 | dbd_rebuild_add.c dbd_dbcheck.c dbd_search.c 14 | cnid_dbd_LDADD = $(top_builddir)/libatalk/libatalk.la @BDB_LIBS@ @ACL_LIBS@ @MYSQL_LIBS@ 15 | 16 | cnid_metad_SOURCES = cnid_metad.c usockfd.c db_param.c 17 | cnid_metad_LDADD = $(top_builddir)/libatalk/libatalk.la @ACL_LIBS@ @MYSQL_LIBS@ 18 | 19 | dbd_SOURCES = cmd_dbd.c \ 20 | cmd_dbd_scanvol.c \ 21 | dbif.c pack.c \ 22 | dbd_add.c \ 23 | dbd_delete.c \ 24 | dbd_getstamp.c \ 25 | dbd_lookup.c \ 26 | dbd_rebuild_add.c \ 27 | dbd_resolve.c \ 28 | dbd_update.c 29 | dbd_LDADD = $(top_builddir)/libatalk/libatalk.la @BDB_LIBS@ @ACL_LIBS@ @MYSQL_LIBS@ 30 | 31 | noinst_HEADERS = dbif.h pack.h db_param.h dbd.h usockfd.h comm.h cmd_dbd.h 32 | 33 | AM_CFLAGS = @BDB_CFLAGS@ -D_PATH_CNID_DBD=\"$(sbindir)/cnid_dbd\" 34 | -------------------------------------------------------------------------------- /etc/cnid_dbd/cmd_dbd.h: -------------------------------------------------------------------------------- 1 | #ifndef CMD_DBD_H 2 | #define CMD_DBD_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include "dbif.h" 9 | 10 | enum logtype {LOGSTD, LOGDEBUG}; 11 | typedef unsigned int dbd_flags_t; 12 | 13 | #define DBD_FLAGS_SCAN (1 << 0) 14 | #define DBD_FLAGS_FORCE (1 << 1) 15 | #define DBD_FLAGS_STATS (1 << 2) 16 | #define DBD_FLAGS_V2TOEA (1 << 3) /* Convert adouble:v2 to adouble:ea */ 17 | #define DBD_FLAGS_VERBOSE (1 << 4) 18 | 19 | #define ADv2_DIRNAME ".AppleDouble" 20 | 21 | #define DIR_DOT_OR_DOTDOT(a) \ 22 | ((strcmp(a, ".") == 0) || (strcmp(a, "..") == 0)) 23 | 24 | extern volatile sig_atomic_t alarmed; 25 | 26 | extern void dbd_log(enum logtype lt, char *fmt, ...); 27 | extern int cmd_dbd_scanvol(struct vol *vol, dbd_flags_t flags); 28 | 29 | #endif /* CMD_DBD_H */ 30 | -------------------------------------------------------------------------------- /etc/cnid_dbd/comm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Joerg Lenneis 2003 3 | * All Rights Reserved. See COPYING. 4 | */ 5 | 6 | #ifndef CNID_DBD_COMM_H 7 | #define CNID_DBD_COMM_H 1 8 | 9 | /* number of seconds to try reading in readt */ 10 | #define CNID_DBD_TIMEOUT 1 11 | 12 | #include 13 | 14 | 15 | extern int comm_init (struct db_param *, int, int); 16 | extern int comm_rcv (struct cnid_dbd_rqst *, time_t, const sigset_t *, time_t *); 17 | extern int comm_snd (struct cnid_dbd_rply *); 18 | extern int comm_nbe (void); 19 | 20 | #endif /* CNID_DBD_COMM_H */ 21 | 22 | -------------------------------------------------------------------------------- /etc/cnid_dbd/db_param.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Joerg Lenneis 2003 3 | * Copyright (C) Frank Lahm 2010 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifndef CNID_DBD_DB_PARAM_H 8 | #define CNID_DBD_DB_PARAM_H 1 9 | 10 | #include 11 | 12 | #define DEFAULT_LOGFILE_AUTOREMOVE 1 13 | #define DEFAULT_CACHESIZE (8 * 1024) /* KB, so 8 MB */ 14 | #define DEFAULT_MAXLOCKS 20000 15 | #define DEFAULT_MAXLOCKOBJS 20000 16 | #define DEFAULT_FLUSH_FREQUENCY 1000 17 | #define DEFAULT_FLUSH_INTERVAL 1800 18 | #define DEFAULT_USOCK_FILE "usock" 19 | #define DEFAULT_FD_TABLE_SIZE 512 20 | #define DEFAULT_IDLE_TIMEOUT (10 * 60) 21 | 22 | struct db_param { 23 | char *dir; 24 | int logfile_autoremove; 25 | int cachesize; /* in KB */ 26 | int maxlocks; 27 | int maxlockobjs; 28 | int flush_interval; 29 | int flush_frequency; 30 | char usock_file[MAXPATHLEN + 1]; 31 | int fd_table_size; 32 | int idle_timeout; 33 | int max_vols; 34 | }; 35 | 36 | extern struct db_param *db_param_read (char *); 37 | 38 | #endif /* CNID_DBD_DB_PARAM_H */ 39 | 40 | -------------------------------------------------------------------------------- /etc/cnid_dbd/dbd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Joerg Lenneis 2003 3 | * Copyright (C) Frank Lahm 2009, 2010 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifndef CNID_DBD_DBD_H 8 | #define CNID_DBD_DBD_H 1 9 | 10 | #include 11 | 12 | #include 13 | 14 | extern int add_cnid(DBD *dbd, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply); 15 | extern int get_cnid(DBD *dbd, struct cnid_dbd_rply *rply); 16 | 17 | extern int dbd_add(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 18 | extern int dbd_lookup(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 19 | extern int dbd_get(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 20 | extern int dbd_resolve(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 21 | extern int dbd_update(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 22 | extern int dbd_delete(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *, int idx); 23 | extern int dbd_getstamp(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 24 | extern int dbd_rebuild_add(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 25 | extern int dbd_search(DBD *dbd, struct cnid_dbd_rqst *, struct cnid_dbd_rply *); 26 | extern int dbd_check_indexes(DBD *dbd, char *); 27 | 28 | #endif /* CNID_DBD_DBD_H */ 29 | -------------------------------------------------------------------------------- /etc/cnid_dbd/dbd_dbcheck.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) Joerg Lenneis 2003 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | #include "pack.h" 21 | #include "dbif.h" 22 | #include "dbd.h" 23 | 24 | int dbd_check_indexes(DBD *dbd, char *dbdir) 25 | { 26 | u_int32_t c_didname = 0, c_devino = 0, c_cnid = 0; 27 | 28 | LOG(log_note, logtype_cnid, "CNID database at `%s' is being checked (quick)", dbdir); 29 | 30 | if (dbif_count(dbd, DBIF_CNID, &c_cnid)) 31 | return -1; 32 | 33 | if (dbif_count(dbd, DBIF_IDX_DEVINO, &c_devino)) 34 | return -1; 35 | 36 | /* bailout after the first error */ 37 | if ( c_cnid != c_devino) { 38 | LOG(log_error, logtype_cnid, "CNID database at `%s' corrupted (%u/%u)", dbdir, c_cnid, c_devino); 39 | return 1; 40 | } 41 | 42 | if (dbif_count(dbd, DBIF_IDX_DIDNAME, &c_didname)) 43 | return -1; 44 | 45 | if ( c_cnid != c_didname) { 46 | LOG(log_error, logtype_cnid, "CNID database at `%s' corrupted (%u/%u)", dbdir, c_cnid, c_didname); 47 | return 1; 48 | } 49 | 50 | LOG(log_note, logtype_cnid, "CNID database at `%s' seems ok, %u entries.", dbdir, c_cnid); 51 | return 0; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /etc/cnid_dbd/dbd_get.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) Joerg Lenneis 2003 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | 20 | #include "dbif.h" 21 | #include "dbd.h" 22 | #include "pack.h" 23 | 24 | 25 | /* Return CNID for a given did/name. */ 26 | 27 | int dbd_get(DBD *dbd, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply) 28 | { 29 | char start[CNID_DID_LEN + MAXPATHLEN + 1], *buf; 30 | DBT key, data; 31 | int rc; 32 | 33 | memset(&key, 0, sizeof(key)); 34 | memset(&data, 0, sizeof(data)); 35 | 36 | rply->namelen = 0; 37 | 38 | buf = start; 39 | memcpy(buf, &rqst->did, sizeof(rqst->did)); 40 | buf += sizeof(rqst->did); 41 | memcpy(buf, rqst->name, rqst->namelen); 42 | *(buf + rqst->namelen) = '\0'; /* Make it a C-string. */ 43 | key.data = start; 44 | key.size = CNID_DID_LEN + rqst->namelen + 1; 45 | 46 | if ((rc = dbif_get(dbd, DBIF_IDX_DIDNAME, &key, &data, 0)) < 0) { 47 | LOG(log_error, logtype_cnid, "dbd_get: Unable to get CNID %u, name %s", ntohl(rqst->did), rqst->name); 48 | rply->result = CNID_DBD_RES_ERR_DB; 49 | return -1; 50 | } 51 | 52 | if (rc == 0) { 53 | LOG(log_debug, logtype_cnid, "cnid_get: CNID not found for did %u name %s", 54 | ntohl(rqst->did), rqst->name); 55 | rply->result = CNID_DBD_RES_NOTFOUND; 56 | return 1; 57 | } 58 | 59 | memcpy(&rply->cnid, data.data, sizeof(rply->cnid)); 60 | 61 | LOG(log_debug, logtype_cnid, "cnid_get: Returning CNID did %u name %s as %u", 62 | ntohl(rqst->did), rqst->name, ntohl(rply->cnid)); 63 | 64 | rply->result = CNID_DBD_RES_OK; 65 | return 1; 66 | } 67 | -------------------------------------------------------------------------------- /etc/cnid_dbd/dbd_getstamp.c: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * 4 | * Copyright (C) Joerg Lenneis 2003 5 | * All Rights Reserved. See COPYING. 6 | */ 7 | 8 | #ifdef HAVE_CONFIG_H 9 | #include "config.h" 10 | #endif /* HAVE_CONFIG_H */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | #include "dbif.h" 20 | #include "dbd.h" 21 | #include "pack.h" 22 | 23 | /* Return the unique stamp associated with this database */ 24 | 25 | int dbd_getstamp(DBD *dbd, struct cnid_dbd_rqst *rqst _U_, struct cnid_dbd_rply *rply) 26 | { 27 | DBT key, data; 28 | int rc; 29 | 30 | 31 | memset(&key, 0, sizeof(key)); 32 | memset(&data, 0, sizeof(data)); 33 | 34 | rply->namelen = 0; 35 | 36 | key.data = ROOTINFO_KEY; 37 | key.size = ROOTINFO_KEYLEN; 38 | 39 | if ((rc = dbif_get(dbd, DBIF_CNID, &key, &data, 0)) < 0) { 40 | LOG(log_error, logtype_cnid, "dbd_getstamp: Error getting rootinfo record"); 41 | rply->result = CNID_DBD_RES_ERR_DB; 42 | return -1; 43 | } 44 | 45 | if (rc == 0) { 46 | LOG(log_error, logtype_cnid, "dbd_getstamp: No rootinfo record found"); 47 | rply->result = CNID_DBD_RES_NOTFOUND; 48 | return 1; 49 | } 50 | 51 | rply->namelen = CNID_DEV_LEN; 52 | rply->name = (char *)data.data + CNID_DEV_OFS; 53 | rply->result = CNID_DBD_RES_OK; 54 | return 1; 55 | } 56 | -------------------------------------------------------------------------------- /etc/cnid_dbd/dbd_resolve.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) Joerg Lenneis 2003 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | #include "dbif.h" 19 | #include "dbd.h" 20 | #include "pack.h" 21 | 22 | /* Return the did/name pair corresponding to a CNID. */ 23 | 24 | int dbd_resolve(DBD *dbd, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply) 25 | { 26 | DBT key, data; 27 | int rc; 28 | 29 | memset(&key, 0, sizeof(key)); 30 | memset(&data, 0, sizeof(data)); 31 | 32 | rply->namelen = 0; 33 | 34 | key.data = (void *) &rqst->cnid; 35 | key.size = sizeof(cnid_t); 36 | 37 | if ((rc = dbif_get(dbd, DBIF_CNID, &key, &data, 0)) < 0) { 38 | LOG(log_error, logtype_cnid, "dbd_resolve: DB Error resolving CNID %u", ntohl(rqst->cnid)); 39 | rply->result = CNID_DBD_RES_ERR_DB; 40 | return -1; 41 | } 42 | 43 | if (rc == 0) { 44 | 45 | LOG(log_debug, logtype_cnid, "dbd_resolve: Could not resolve CNID %u", ntohl(rqst->cnid)); 46 | 47 | rply->result = CNID_DBD_RES_NOTFOUND; 48 | return 1; 49 | } 50 | 51 | memcpy(&rply->did, (char *) data.data + CNID_DID_OFS, sizeof(cnid_t)); 52 | 53 | rply->namelen = data.size; 54 | rply->name = (char *)data.data; 55 | 56 | LOG(log_debug, logtype_cnid, "dbd_resolve(CNID: %u): did: %u, name: \"%s\"", 57 | ntohl(rqst->cnid), ntohl(rply->did), rply->name + CNID_NAME_OFS); 58 | 59 | rply->result = CNID_DBD_RES_OK; 60 | return 1; 61 | } 62 | -------------------------------------------------------------------------------- /etc/cnid_dbd/dbd_search.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Frank Lahm 2010 3 | * All Rights Reserved. See COPYING. 4 | */ 5 | 6 | #ifdef HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif /* HAVE_CONFIG_H */ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #include "dbif.h" 18 | #include "dbd.h" 19 | #include "pack.h" 20 | 21 | int dbd_search(DBD *dbd, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply) 22 | { 23 | DBT key; 24 | int results; 25 | static char resbuf[DBD_MAX_SRCH_RSLTS * sizeof(cnid_t)]; 26 | 27 | LOG(log_debug, logtype_cnid, "dbd_search(\"%s\"):", rqst->name); 28 | 29 | memset(&key, 0, sizeof(key)); 30 | rply->name = resbuf; 31 | rply->namelen = 0; 32 | 33 | key.data = (char *)rqst->name; 34 | key.size = rqst->namelen; 35 | 36 | if ((results = dbif_search(dbd, &key, resbuf)) < 0) { 37 | LOG(log_error, logtype_cnid, "dbd_search(\"%s\"): db error", rqst->name); 38 | rply->result = CNID_DBD_RES_ERR_DB; 39 | return -1; 40 | } 41 | if (results) { 42 | LOG(log_debug, logtype_cnid, "dbd_search(\"%s\"): %d matches", rqst->name, results); 43 | rply->namelen = results * sizeof(cnid_t); 44 | rply->result = CNID_DBD_RES_OK; 45 | } else { 46 | LOG(log_debug, logtype_cnid, "dbd_search(\"%s\"): no matches", rqst->name); 47 | rply->result = CNID_DBD_RES_NOTFOUND; 48 | } 49 | 50 | return 1; 51 | } 52 | -------------------------------------------------------------------------------- /etc/cnid_dbd/dbd_update.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Joerg Lenneis 2003 3 | * Copyright (C) Frank Lahm 2009,2010 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | 19 | #include "pack.h" 20 | #include "dbif.h" 21 | #include "dbd.h" 22 | 23 | 24 | /* 25 | cnid_update: takes the given cnid and updates the metadata. 26 | First, delete given CNID, then re-insert. 27 | */ 28 | 29 | int dbd_update(DBD *dbd, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply) 30 | { 31 | DBT key, data; 32 | 33 | memset(&key, 0, sizeof(key)); 34 | memset(&data, 0, sizeof(data)); 35 | rply->namelen = 0; 36 | 37 | /* Try to wipe everything, also using the indexes */ 38 | if (dbd_delete(dbd, rqst, rply, DBIF_CNID) < 0) 39 | goto err_db; 40 | if (dbd_delete(dbd, rqst, rply, DBIF_IDX_DEVINO) < 0) 41 | goto err_db; 42 | if (dbd_delete(dbd, rqst, rply, DBIF_IDX_DIDNAME) < 0) 43 | goto err_db; 44 | 45 | /* Make a new entry. */ 46 | key.data = &rqst->cnid; 47 | key.size = sizeof(rqst->cnid); 48 | data.data = pack_cnid_data(rqst); 49 | data.size = CNID_HEADER_LEN + rqst->namelen + 1; 50 | memcpy(data.data, &rqst->cnid, sizeof(rqst->cnid)); 51 | 52 | if (dbif_put(dbd, DBIF_CNID, &key, &data, 0) < 0) 53 | goto err_db; 54 | 55 | LOG(log_debug, logtype_cnid, "dbd_update: Updated dbd with dev/ino: 0x%llx/0x%llx, did: %u, name: %s, cnid: %u", 56 | (unsigned long long)rqst->dev, (unsigned long long)rqst->ino, ntohl(rqst->did), rqst->name, ntohl(rqst->cnid)); 57 | 58 | rply->result = CNID_DBD_RES_OK; 59 | return 1; 60 | 61 | err_db: 62 | LOG(log_error, logtype_cnid, "dbd_update: Unable to update CNID: %u, dev/ino: 0x%llx/0x%llx, DID: %u: %s", 63 | ntohl(rqst->cnid), (unsigned long long)rqst->dev, (unsigned long long)rqst->ino, ntohl(rqst->did), rqst->name); 64 | 65 | rply->result = CNID_DBD_RES_ERR_DB; 66 | return -1; 67 | } 68 | -------------------------------------------------------------------------------- /etc/cnid_dbd/pack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Joerg Lenneis 2003 3 | * Copyright (C) Frank Lahm 2010 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifndef CNID_DBD_PACK_H 8 | #define CNID_DBD_PACK_H 1 9 | 10 | #include 11 | #include 12 | 13 | extern unsigned char *pack_cnid_data(struct cnid_dbd_rqst *); 14 | extern int didname(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey); 15 | extern int devino(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey); 16 | extern int idxname(DB *dbp, const DBT *pkey, const DBT *pdata, DBT *skey); 17 | extern void pack_setvol(const struct vol *vol); 18 | #endif /* CNID_DBD_PACK_H */ 19 | -------------------------------------------------------------------------------- /etc/cnid_dbd/usockfd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (C) Joerg Lenneis 2003 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | #ifndef CNID_DBD_USOCKFD_H 8 | #define CNID_DBD_USOCKFD_H 1 9 | 10 | 11 | 12 | #include 13 | 14 | 15 | extern int usockfd_create (char *, mode_t, int); 16 | extern int tsockfd_create (char *, char *, int); 17 | extern int usockfd_check (int, const sigset_t *); 18 | 19 | #ifndef OSSH_ALIGNBYTES 20 | #define OSSH_ALIGNBYTES (sizeof(int) - 1) 21 | #endif 22 | #ifndef __CMSG_ALIGN 23 | #ifndef u_int 24 | #define u_int unsigned int 25 | #endif 26 | #define __CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES) 27 | #endif 28 | 29 | /* Length of the contents of a control message of length len */ 30 | #ifndef CMSG_LEN 31 | #define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) 32 | #endif 33 | 34 | /* Length of the space taken up by a padded control message of length len */ 35 | #ifndef CMSG_SPACE 36 | #define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len)) 37 | #endif 38 | 39 | 40 | 41 | #endif /* CNID_DBD_USOCKFD_H */ 42 | -------------------------------------------------------------------------------- /etc/netatalk/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for etc/netatlk/ 2 | 3 | pkgconfdir = @PKGCONFDIR@ 4 | 5 | sbin_PROGRAMS = netatalk 6 | 7 | netatalk_SOURCES = netatalk.c afp_avahi.c afp_mdns.c afp_zeroconf.c 8 | netatalk_CFLAGS = \ 9 | @ZEROCONF_CFLAGS@ \ 10 | -D_PATH_CONFDIR=\"$(pkgconfdir)/\" \ 11 | -D_PATH_STATEDIR='"$(localstatedir)/netatalk/"' \ 12 | -D_PATH_AFPD=\"$(sbindir)/afpd\" \ 13 | -D_PATH_CNID_METAD=\"$(sbindir)/cnid_metad\" 14 | 15 | netatalk_LDADD = \ 16 | @MYSQL_LIBS@ \ 17 | @ZEROCONF_LIBS@ \ 18 | $(top_builddir)/libatalk/libatalk.la 19 | 20 | netatalk_LDFLAGS = 21 | 22 | if USE_BUILTIN_LIBEVENT 23 | netatalk_CFLAGS += \ 24 | -I$(top_srcdir)/libevent/include \ 25 | -I$(top_builddir)/libevent/include 26 | 27 | netatalk_LDADD += \ 28 | $(top_builddir)/libevent/libevent.la 29 | else 30 | netatalk_CFLAGS += @LIBEVENT_CFLAGS@ 31 | netatalk_LDFLAGS += @LIBEVENT_LDFLAGS@ -levent 32 | endif 33 | 34 | noinst_HEADERS = afp_zeroconf.h afp_avahi.h afp_mdns.h 35 | -------------------------------------------------------------------------------- /etc/netatalk/afp_avahi.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ 2 | /* 3 | * Author: Daniel S. Haischt 4 | * Purpose: Avahi based Zeroconf support 5 | * Docs: http://avahi.org/download/doxygen/ 6 | * 7 | */ 8 | 9 | #ifndef AFPD_AVAHI_H 10 | #define AFPD_AVAHI_H 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | struct context { 26 | /* Avahi stuff */ 27 | int thread_running; 28 | AvahiThreadedPoll *threaded_poll; 29 | AvahiClient *client; 30 | AvahiEntryGroup *group; 31 | /* Netatalk stuff */ 32 | const AFPObj *obj; 33 | }; 34 | 35 | /* prototype definitions */ 36 | void av_zeroconf_register(const AFPObj *obj); 37 | int av_zeroconf_unregister(void); 38 | 39 | #endif /* AFPD_AVAHI_H */ 40 | -------------------------------------------------------------------------------- /etc/netatalk/afp_mdns.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Lee Essen 3 | * Based on: avahi support from Daniel S. Haischt 4 | * Purpose: mdns based Zeroconf support 5 | */ 6 | 7 | #ifndef AFPD_MDNS_H 8 | #define AFPD_MDNS_H 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | /* prototype definitions */ 19 | void md_zeroconf_register(const AFPObj *obj); 20 | int md_zeroconf_unregister(void); 21 | 22 | #endif /* AFPD_MDNS_H */ 23 | -------------------------------------------------------------------------------- /etc/netatalk/afp_zeroconf.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ 2 | /* 3 | * Author: Daniel S. Haischt 4 | * Purpose: Zeroconf facade, that abstracts access to a 5 | * particular Zeroconf implementation 6 | * Doc: http://www.dns-sd.org/ 7 | * 8 | */ 9 | 10 | #ifdef HAVE_CONFIG_H 11 | #include 12 | #endif 13 | 14 | #include "afp_zeroconf.h" 15 | 16 | #ifdef HAVE_MDNS 17 | #include "afp_mdns.h" 18 | #elif defined (HAVE_AVAHI) 19 | #include "afp_avahi.h" 20 | #endif 21 | 22 | 23 | /* 24 | * Functions (actually they are just facades) 25 | */ 26 | void zeroconf_register(const AFPObj *configs) 27 | { 28 | #if defined (HAVE_MDNS) 29 | LOG(log_debug, logtype_afpd, "Attempting to register with mDNS using mDNSResponder"); 30 | 31 | md_zeroconf_register(configs); 32 | #elif defined (HAVE_AVAHI) 33 | LOG(log_debug, logtype_afpd, "Attempting to register with mDNS using Avahi"); 34 | 35 | av_zeroconf_register(configs); 36 | #endif 37 | } 38 | 39 | void zeroconf_deregister(void) 40 | { 41 | #if defined (HAVE_MDNS) 42 | LOG(log_debug, logtype_afpd, "Attempting to de-register mDNS using mDNSResponder"); 43 | md_zeroconf_unregister(); 44 | #elif defined (HAVE_AVAHI) 45 | LOG(log_debug, logtype_afpd, "Attempting to de-register mDNS using Avahi"); 46 | av_zeroconf_unregister(); 47 | #endif 48 | } 49 | -------------------------------------------------------------------------------- /etc/netatalk/afp_zeroconf.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ 2 | /* 3 | * Author: Daniel S. Haischt 4 | * Purpose: Zeroconf facade, that abstracts access to a 5 | * particular Zeroconf implementation 6 | * Doc: http://www.dns-sd.org/ 7 | * 8 | */ 9 | 10 | #ifndef AFPD_ZEROCONF_H 11 | #define AFPD_ZEROCONF_H 12 | 13 | #include 14 | 15 | #define AFP_DNS_SERVICE_TYPE "_afpovertcp._tcp" 16 | #define ADISK_SERVICE_TYPE "_adisk._tcp" 17 | #define DEV_INFO_SERVICE_TYPE "_device-info._tcp" 18 | 19 | #define MAXINSTANCENAMELEN 63 20 | 21 | /* 22 | * Prototype Definitions 23 | */ 24 | 25 | /* 26 | * registers service with a particular Zerconf implemenation. 27 | */ 28 | void zeroconf_register(const AFPObj *obj); 29 | 30 | /* 31 | * de-registers the ntpd service with a particular Zerconf implemenation. 32 | */ 33 | void zeroconf_deregister(void); 34 | 35 | #endif /* AFPD_ZEROCONF_H */ 36 | -------------------------------------------------------------------------------- /etc/spotlight/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for etc/spotlight/ 2 | 3 | pkgconfdir = @PKGCONFDIR@ 4 | noinst_LTLIBRARIES = 5 | noinst_PROGRAMS = 6 | noinst_HEADERS = sparql_map.h 7 | BUILT_SOURCES = 8 | 9 | AM_YFLAGS = -d 10 | 11 | if HAVE_TRACKER 12 | BUILT_SOURCES += sparql_parser.h 13 | noinst_PROGRAMS += srp 14 | noinst_LTLIBRARIES += libspotlight.la 15 | 16 | libspotlight_la_SOURCES = \ 17 | sparql_map.c \ 18 | sparql_parser.y \ 19 | spotlight_rawquery_lexer.l 20 | 21 | libspotlight_la_CFLAGS = \ 22 | -DDBUS_API_SUBJECT_TO_CHANGE \ 23 | @TRACKER_CFLAGS@ \ 24 | -D_PATH_STATEDIR='"$(localstatedir)/netatalk"' 25 | 26 | libspotlight_la_LDFLAGS = @TRACKER_LIBS@ @TRACKER_MINER_LIBS@ 27 | 28 | srp_SOURCES = \ 29 | sparql_map.c \ 30 | sparql_parser.y \ 31 | spotlight_rawquery_lexer.l 32 | 33 | srp_CFLAGS = -DMAIN -I$(top_srcdir)/include @TRACKER_CFLAGS@ 34 | srp_LDADD = $(top_builddir)/libatalk/libatalk.la @MYSQL_LIBS@ 35 | endif 36 | -------------------------------------------------------------------------------- /etc/spotlight/spotlight_rawquery_lexer.l: -------------------------------------------------------------------------------- 1 | %top{ 2 | #ifdef HAVE_CONFIG_H 3 | #include "config.h" 4 | #endif /* HAVE_CONFIG_H */ 5 | } 6 | 7 | %{ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #ifdef HAVE_TRACKER 13 | #include "sparql_parser.h" 14 | #define SLQ_VAR ssp_slq 15 | #endif 16 | %} 17 | 18 | ASC [a-zA-Z0-9_\*\:\-\.] 19 | U [\x80-\xbf] 20 | U2 [\xc2-\xdf] 21 | U3 [\xe0-\xef] 22 | U4 [\xf0-\xf4] 23 | 24 | UANY {ASC}|{U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} 25 | UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U} 26 | 27 | %% 28 | InRange return FUNC_INRANGE; 29 | \$time\.iso return DATE_ISO; 30 | false {yylval.bval = false; return BOOL;} 31 | true {yylval.bval = true; return BOOL;} 32 | \" return QUOTE; 33 | \( return OBRACE; 34 | \) return CBRACE; 35 | \&\& return AND; 36 | \|\| return OR; 37 | \=\= return EQUAL; 38 | \= return EQUAL; 39 | \!\= return UNEQUAL; 40 | \< return LT; 41 | \> return GT; 42 | \, return COMMA; 43 | {UANY}+ {yylval.sval = talloc_strdup(SLQ_VAR, yytext); return WORD;} 44 | [ \t\n] /* ignore */ 45 | %% 46 | -------------------------------------------------------------------------------- /etc/uams/openssl_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2017 Denis Bychkov (manover@gmail.com) 4 | 5 | This file is released under the GNU General Public License (GPLv2). 6 | The full license text is available at: 7 | 8 | http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt 9 | */ 10 | 11 | #ifndef OPENSSL_COMPAT_H 12 | #define OPENSSL_COMPAT_H 13 | 14 | #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) 15 | inline static int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) 16 | { 17 | /* If the fields p and g in d are NULL, the corresponding input 18 | * parameters MUST be non-NULL. q may remain NULL. 19 | */ 20 | if ((dh->p == NULL && p == NULL) || (dh->g == NULL && g == NULL)) 21 | return 0; 22 | 23 | if (p != NULL) 24 | dh->p = p; 25 | if (q != NULL) 26 | dh->q = q; 27 | if (g != NULL) 28 | dh->g = g; 29 | 30 | if (q != NULL) 31 | dh->length = BN_num_bits(q); 32 | 33 | return 1; 34 | } 35 | 36 | inline static void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) 37 | { 38 | if (pub_key != NULL) 39 | *pub_key = dh->pub_key; 40 | if (priv_key != NULL) 41 | *priv_key = dh->priv_key; 42 | } 43 | #endif /* OPENSSL_VERSION_NUMBER */ 44 | 45 | #endif /* OPENSSL_COMPAT_H */ 46 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for include/ 2 | 3 | SUBDIRS = atalk 4 | -------------------------------------------------------------------------------- /include/atalk/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for include/atalk/ 2 | 3 | atalkincludedir = $(includedir)/atalk 4 | BUILT_SOURCES = 5 | CLEANFILES = 6 | 7 | atalkinclude_HEADERS = \ 8 | adouble.h \ 9 | afp.h \ 10 | vfs.h \ 11 | cnid.h \ 12 | logger.h \ 13 | netatalk_conf.h \ 14 | paths.h \ 15 | unicode.h \ 16 | util.h \ 17 | ea.h \ 18 | acl.h \ 19 | unix.h \ 20 | volume.h \ 21 | standards.h \ 22 | bstrlib.h \ 23 | list.h \ 24 | globals.h \ 25 | compat.h \ 26 | uam.h \ 27 | iniparser.h \ 28 | dictionary.h \ 29 | hash.h 30 | 31 | noinst_HEADERS = \ 32 | directory.h \ 33 | uuid.h \ 34 | queue.h \ 35 | server_child.h \ 36 | server_ipc.h \ 37 | tdb.h \ 38 | cnid_bdb_private.h \ 39 | cnid_mysql_private.h \ 40 | cnid_private.h \ 41 | bstradd.h \ 42 | errchk.h \ 43 | ftw.h \ 44 | dsi.h \ 45 | ldapconfig.h \ 46 | talloc.h \ 47 | dalloc.h \ 48 | byteorder.h \ 49 | fce_api.h \ 50 | spotlight.h 51 | 52 | EXTRA_DIST = afp_dtrace.d 53 | 54 | if WITH_DTRACE 55 | BUILT_SOURCES += afp_dtrace.h 56 | CLEANFILES += afp_dtrace.h 57 | afp_dtrace.h: $(top_srcdir)/include/atalk/afp_dtrace.d 58 | $(LIBTOOL) --mode=execute dtrace -o afp_dtrace.h -h -s $(top_srcdir)/include/atalk/afp_dtrace.d 59 | endif 60 | -------------------------------------------------------------------------------- /include/atalk/acl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef ATALK_ACL_H 16 | #define ATALK_ACL_H 17 | 18 | #ifdef HAVE_CONFIG_H 19 | #include "config.h" 20 | #endif /* HAVE_CONFIG_H */ 21 | 22 | #ifdef HAVE_ACLS 23 | 24 | #define O_NETATALK_ACL (O_NOFOLLOW << 1) 25 | #define O_IGNORE (O_NOFOLLOW << 2) 26 | 27 | #ifdef HAVE_SOLARIS_ACLS 28 | #include 29 | #endif 30 | #ifdef HAVE_FREEBSD_SUNACL 31 | #include 32 | #endif 33 | 34 | #ifdef HAVE_NFSV4_ACLS 35 | 36 | #define chmod_acl nfsv4_chmod 37 | 38 | extern int get_nfsv4_acl(const char *name, ace_t **retAces); 39 | extern int strip_trivial_aces(ace_t **saces, int sacecount); 40 | extern int strip_nontrivial_aces(ace_t **saces, int sacecount); 41 | extern ace_t *concat_aces(ace_t *aces1, int ace1count, ace_t *aces2, int ace2count); 42 | extern int nfsv4_chmod(char *name, mode_t mode); 43 | 44 | #endif /* HAVE_NFSV4_ACLS */ 45 | 46 | #ifdef HAVE_POSIX_ACLS 47 | #include 48 | #include 49 | #include 50 | 51 | #define chmod_acl posix_chmod 52 | #define fchmod_acl posix_fchmod 53 | 54 | extern int posix_chmod(const char *name, mode_t mode); 55 | extern int posix_fchmod(int fd, mode_t mode); 56 | 57 | #endif /* HAVE_POSIX_ACLS */ 58 | 59 | extern int remove_acl_vfs(const char *name); 60 | 61 | #else /* HAVE_ACLS=no */ 62 | 63 | #define O_NETATALK_ACL 0 64 | #define O_IGNORE 0 65 | #define chmod_acl chmod 66 | 67 | #endif /* HAVE_ACLS */ 68 | 69 | #endif /* ATALK_ACL_H */ 70 | -------------------------------------------------------------------------------- /include/atalk/afp_dtrace.d: -------------------------------------------------------------------------------- 1 | provider afp { 2 | probe afpfunc__start(int func, char *funcname); 3 | probe afpfunc__done(int func, char *funcname); 4 | probe read__start(long size); 5 | probe read__done(); 6 | probe write__start(long size); 7 | probe write__done(); 8 | probe cnid__start(char *cnidfunc); 9 | probe cnid__done(); 10 | }; 11 | -------------------------------------------------------------------------------- /include/atalk/bstradd.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | /*! 16 | * @file 17 | * Additional functions for bstrlib. 18 | */ 19 | 20 | #ifndef ATALK_BSTRADD_H 21 | #define ATALK_BSTRADD_H 22 | 23 | #ifdef HAVE_CONFIG_H 24 | #include 25 | #endif 26 | 27 | #include 28 | 29 | #define cfrombstr(b) ((char *)((b)->data)) 30 | 31 | /* strip slashes from end of a bstring */ 32 | #define BSTRING_STRIP_SLASH(a) \ 33 | do { \ 34 | while (bchar((a), blength(a) - 1) == '/') \ 35 | bdelete((a), blength(a) - 1, 1); \ 36 | } while (0); 37 | 38 | typedef struct tagbstring static_bstring; 39 | 40 | extern bstring brefcstr(const char *str); 41 | extern int bunrefcstr(bstring b); 42 | 43 | extern struct bstrList *bstrListCreateMin(int min); 44 | extern int bstrListPush(struct bstrList *sl, bstring bs); 45 | extern bstring bstrListPop(struct bstrList *sl); 46 | extern bstring bjoinInv(const struct bstrList * bl, const_bstring sep); 47 | #endif /* ATALK_BSTRADD_H */ 48 | -------------------------------------------------------------------------------- /include/atalk/cnid_bdb_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Interface to the cnid_dbd daemon that stores/retrieves CNIDs from a database. 3 | */ 4 | 5 | 6 | #ifndef _ATALK_CNID_DBD_PRIVATE_H 7 | #define _ATALK_CNID_DBD_PRIVATE_H 1 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #define CNID_DBD_OP_OPEN 0x01 16 | #define CNID_DBD_OP_CLOSE 0x02 17 | #define CNID_DBD_OP_ADD 0x03 18 | #define CNID_DBD_OP_GET 0x04 19 | #define CNID_DBD_OP_RESOLVE 0x05 20 | #define CNID_DBD_OP_LOOKUP 0x06 21 | #define CNID_DBD_OP_UPDATE 0x07 22 | #define CNID_DBD_OP_DELETE 0x08 23 | #define CNID_DBD_OP_MANGLE_ADD 0x09 24 | #define CNID_DBD_OP_MANGLE_GET 0x0a 25 | #define CNID_DBD_OP_GETSTAMP 0x0b 26 | #define CNID_DBD_OP_REBUILD_ADD 0x0c 27 | #define CNID_DBD_OP_SEARCH 0x0d 28 | #define CNID_DBD_OP_WIPE 0x0e 29 | 30 | #define CNID_DBD_RES_OK 0x00 31 | #define CNID_DBD_RES_NOTFOUND 0x01 32 | #define CNID_DBD_RES_ERR_DB 0x02 33 | #define CNID_DBD_RES_ERR_MAX 0x03 34 | #define CNID_DBD_RES_ERR_DUPLCNID 0x04 35 | #define CNID_DBD_RES_SRCH_CNT 0x05 36 | #define CNID_DBD_RES_SRCH_DONE 0x06 37 | 38 | #define DBD_MAX_SRCH_RSLTS 100 39 | #define DBD_NUM_OPEN_ARGS 3 40 | 41 | struct cnid_dbd_rqst { 42 | int op; 43 | cnid_t cnid; 44 | dev_t dev; 45 | ino_t ino; 46 | uint32_t type; 47 | cnid_t did; 48 | const char *name; 49 | size_t namelen; 50 | }; 51 | 52 | struct cnid_dbd_rply { 53 | int result; 54 | cnid_t cnid; 55 | cnid_t did; 56 | char *name; 57 | size_t namelen; 58 | }; 59 | 60 | typedef struct CNID_bdb_private { 61 | struct vol *vol; 62 | int fd; /* File descriptor to cnid_dbd */ 63 | char stamp[ADEDLEN_PRIVSYN]; /* db timestamp */ 64 | char *client_stamp; 65 | size_t stamp_size; 66 | int notfirst; /* already open before */ 67 | int changed; /* stamp differ */ 68 | } CNID_bdb_private; 69 | 70 | 71 | #endif /* include/atalk/cnid_dbd.h */ 72 | -------------------------------------------------------------------------------- /include/atalk/cnid_mysql_private.h: -------------------------------------------------------------------------------- 1 | #ifndef _ATALK_CNID_MYSQL_PRIVATE_H 2 | #define _ATALK_CNID_MYSQL_PRIVATE_H 1 3 | 4 | #include 5 | #include 6 | 7 | #define CNID_MYSQL_FLAG_DEPLETED (1 << 0) /* CNID set overflowed */ 8 | 9 | typedef struct CNID_mysql_private { 10 | struct vol *vol; 11 | uint32_t cnid_mysql_flags; 12 | MYSQL *cnid_mysql_con; 13 | char *cnid_mysql_voluuid_str; 14 | cnid_t cnid_mysql_hint; 15 | MYSQL_STMT *cnid_lookup_stmt; 16 | MYSQL_STMT *cnid_add_stmt; 17 | MYSQL_STMT *cnid_put_stmt; 18 | } CNID_mysql_private; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /include/atalk/compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1996 Regents of The University of Michigan. 3 | * All Rights Reserved. See COPYRIGHT. 4 | * 5 | * NOTE: SunOS 4 and ultrix are pretty much the only reason why there 6 | * are checks for EINTR everywhere. 7 | */ 8 | 9 | #ifdef HAVE_CONFIG_H 10 | #include "config.h" 11 | 12 | #include 13 | 14 | #if defined(ultrix) || defined(_IBMR2) || defined(NEED_GETUSERSHELL) 15 | extern char *getusershell (void); 16 | #endif 17 | 18 | /* OpenBSD */ 19 | #if defined(__OpenBSD__) && !defined(ENOTSUP) 20 | #define ENOTSUP EOPNOTSUPP 21 | #endif 22 | 23 | #if !defined(HAVE_PSELECT) || defined(__OpenBSD__) 24 | extern int pselect(int, fd_set * restrict, fd_set * restrict, 25 | fd_set * restrict, const struct timespec * restrict, 26 | const sigset_t * restrict); 27 | #endif 28 | 29 | #ifndef HAVE_FLOCK 30 | extern int flock (int, int); 31 | #endif 32 | 33 | #ifndef HAVE_STRNLEN 34 | extern size_t strnlen(const char *s, size_t n); 35 | #endif 36 | 37 | #ifndef HAVE_STRLCPY 38 | extern size_t strlcpy (char *, const char *, size_t); 39 | #endif 40 | 41 | #ifndef HAVE_STRLCAT 42 | extern size_t strlcat (char *, const char *, size_t); 43 | #endif 44 | 45 | #ifndef HAVE_VASPRINTF 46 | #include 47 | #include 48 | extern int vasprintf(char **ret, const char *fmt, va_list ap); 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/atalk/dalloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifdef HAVE_CONFIG_H 16 | #include "config.h" 17 | #endif /* HAVE_CONFIG_H */ 18 | 19 | #ifndef DALLOC_H 20 | #define DALLOC_H 21 | 22 | #include 23 | 24 | /* dynamic datastore */ 25 | typedef struct { 26 | void **dd_talloc_array; 27 | } DALLOC_CTX; 28 | 29 | /* Use dalloc_add_copy() macro, not this function */ 30 | extern int dalloc_add_talloc_chunk(DALLOC_CTX *dd, void *talloc_chunk, void *obj, size_t size); 31 | 32 | #define dalloc_add_copy(d, obj, type) dalloc_add_talloc_chunk((d), talloc((d), type), (obj), sizeof(type)); 33 | #define dalloc_add(d, obj, type) dalloc_add_talloc_chunk((d), NULL, (obj), 0); 34 | extern void *dalloc_get(const DALLOC_CTX *d, ...); 35 | extern void *dalloc_value_for_key(const DALLOC_CTX *d, ...); 36 | extern int dalloc_size(DALLOC_CTX *d); 37 | extern char *dalloc_strdup(const void *ctx, const char *string); 38 | extern char *dalloc_strndup(const void *ctx, const char *string, size_t n); 39 | #endif /* DALLOC_H */ 40 | -------------------------------------------------------------------------------- /include/atalk/ldapconfig.h: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_LDAP 2 | 3 | #ifndef LDAPCONFIG_H 4 | #define LDAPCONFIG_H 5 | 6 | #include 7 | 8 | /* One function does the whole job */ 9 | extern int acl_ldap_readconfig(dictionary *iniconfig); 10 | extern void acl_ldap_freeconfig(void); 11 | 12 | /* These are the prefvalues */ 13 | extern char *ldap_server; 14 | extern int ldap_auth_method; 15 | extern char *ldap_auth_dn; 16 | extern char *ldap_auth_pw; 17 | extern char *ldap_userbase; 18 | extern char *ldap_groupbase; 19 | extern char *ldap_uuid_attr; 20 | extern char *ldap_uuid_string; 21 | extern char *ldap_name_attr; 22 | extern char *ldap_group_attr; 23 | extern char *ldap_uid_attr; 24 | extern char *ldap_userfilter; 25 | extern char *ldap_groupfilter; 26 | extern int ldap_uuid_encoding; 27 | 28 | typedef enum { 29 | LDAP_UUID_ENCODING_STRING = 0, /* Plain ASCII string */ 30 | LDAP_UUID_ENCODING_MSGUID = 1 /* Raw byte array, from Active Directory objectGUID */ 31 | } ldap_uuid_encoding_type; 32 | 33 | struct ldap_pref { 34 | const void *pref; 35 | char *name; 36 | int strorint; /* string to just store in char * or convert to int ? */ 37 | int intfromarray; /* convert to int, but use string to int mapping array pref_array[] */ 38 | int valid; /* -1 = mandatory, 0 = omittable/valid */ 39 | int valid_save; /* copy of 'valid', used when resettting config */ 40 | }; 41 | 42 | struct pref_array { 43 | const char *pref; /* name of pref from ldap_prefs[] to which this value corresponds */ 44 | char *valuestring; /* config string */ 45 | int value; /* corresponding value */ 46 | }; 47 | 48 | 49 | 50 | /* For parsing */ 51 | extern struct ldap_pref ldap_prefs[]; 52 | extern struct pref_array prefs_array[]; 53 | extern int ldap_config_valid; 54 | 55 | #endif /* LDAPCONFIG_H */ 56 | 57 | #endif /* HAVE_LDAP */ 58 | -------------------------------------------------------------------------------- /include/atalk/netatalk_conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef AFP_CONFIG_H 16 | #define AFP_CONFIG_H 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | extern int afp_config_parse(AFPObj *obj, char *processname); 24 | extern void afp_config_free(AFPObj *obj); 25 | extern int load_charset(struct vol *vol); 26 | extern int load_volumes(AFPObj *obj, lv_flags_t flags); 27 | extern void unload_volumes(AFPObj *obj); 28 | extern struct vol *getvolumes(void); 29 | extern struct vol *getvolbyvid(const uint16_t); 30 | extern struct vol *getvolbypath(AFPObj *obj, const char *path); 31 | extern struct vol *getvolbyname(const char *name); 32 | extern void volume_free(struct vol *vol); 33 | extern void volume_unlink(struct vol *volume); 34 | 35 | /* Extension type/creator mapping */ 36 | struct extmap *getdefextmap(void); 37 | struct extmap *getextmap(const char *path); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/atalk/paths.h: -------------------------------------------------------------------------------- 1 | #ifndef ATALK_PATHS_H 2 | #define ATALK_PATHS_H 1 3 | 4 | /* we need a way of concatenating strings */ 5 | #ifdef __STDC__ 6 | #ifdef HAVE_BROKEN_CPP 7 | #define BROKEN_ECHO(a) a 8 | #define ATALKPATHCAT(a,b) BROKEN_ECHO(a)##BROKEN_ECHO(b) 9 | #else 10 | #define ATALKPATHCAT(a,b) a b 11 | #endif 12 | #else 13 | #define ATALKPATHCAT(a,b) a/**/b 14 | #endif 15 | 16 | #endif /* atalk/paths.h */ 17 | 18 | -------------------------------------------------------------------------------- /include/atalk/queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 | */ 18 | 19 | #ifndef ATALK_QUEUE_H 20 | #define ATALK_QUEUE_H 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include "config.h" 24 | #endif /* HAVE_CONFIG_H */ 25 | 26 | typedef struct qnode { 27 | struct qnode *prev; 28 | struct qnode *next; 29 | void *data; 30 | } qnode_t; 31 | 32 | typedef qnode_t q_t; 33 | 34 | extern q_t *queue_init(void); 35 | extern void queue_destroy(q_t *q, void (*callback)(void *)); 36 | #define queue_free(q) queue_destroy((q), free) 37 | extern qnode_t *enqueue(q_t *q, void *data); 38 | extern qnode_t *prequeue(q_t *q, void *data); 39 | extern void *dequeue(q_t *q); 40 | 41 | #endif /* ATALK_QUEUE_H */ 42 | -------------------------------------------------------------------------------- /include/atalk/server_ipc.h: -------------------------------------------------------------------------------- 1 | #ifndef ATALK_SERVER_IPC_H 2 | #define ATALK_SERVER_IPC_H 3 | 4 | #include 5 | #include 6 | 7 | /* Remember to add IPC commands to server_ipc.c:ipc_cmd_str[] */ 8 | #define IPC_DISCOLDSESSION 0 9 | #define IPC_GETSESSION 1 10 | #define IPC_STATE 2 /* pass AFP session state */ 11 | #define IPC_VOLUMES 3 /* pass list of open volumes */ 12 | 13 | extern int ipc_server_read(server_child_t *children, int fd); 14 | extern int ipc_child_write(int fd, uint16_t command, int len, void *token); 15 | extern int ipc_child_state(AFPObj *obj, uint16_t state); 16 | 17 | #endif /* IPC_GETSESSION_LOGIN */ 18 | -------------------------------------------------------------------------------- /include/atalk/standards.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef ATALK_STANDARDS_H 16 | #define ATALK_STANDARDS_H 1 17 | 18 | #ifdef HAVE_CONFIG_H 19 | #include "config.h" 20 | #endif 21 | 22 | #if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) 23 | # ifndef _XOPEN_SOURCE 24 | # define _XOPEN_SOURCE 600 25 | # endif 26 | # ifndef __EXTENSIONS__ 27 | # define __EXTENSIONS__ 28 | # endif 29 | # ifndef _GNU_SOURCE 30 | # define _GNU_SOURCE 31 | # endif 32 | #endif 33 | 34 | #endif /* ATALK_STANDARDS_H */ 35 | -------------------------------------------------------------------------------- /include/atalk/unix.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2009 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef ATALK_UNIX_H 16 | #define ATALK_UNIX_H 17 | 18 | #ifdef HAVE_CONFIG_H 19 | #include 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #define NETATALK_DIOSZ_STACK 65536 29 | #define NETATALK_DIOSZ_HEAP (1024*1024) 30 | 31 | struct vol; 32 | 33 | /* vfs/unix.c */ 34 | extern int netatalk_unlink(const char *name); 35 | extern int netatalk_unlinkat(int dirfd, const char *name); 36 | extern int statat(int dirfd, const char *path, struct stat *st); 37 | extern DIR *opendirat(int dirfd, const char *path); 38 | 39 | /* rmdir ENOENT not an error */ 40 | extern int netatalk_rmdir(int dirfd, const char *name); 41 | extern int netatalk_rmdir_all_errors(int dirfd, const char *name); 42 | 43 | extern int setfilmode(const struct vol *vol, const char *name, mode_t mode, struct stat *st); 44 | extern int dir_rx_set(mode_t mode); 45 | extern int unix_rename(int sfd, const char *oldpath, int dfd, const char *newpath); 46 | extern int copy_file(int sfd, const char *src, const char *dst, mode_t mode); 47 | extern int copy_file_fd(int sfd, int dfd); 48 | extern int copy_ea(const char *ea, int sfd, const char *src, const char *dst, mode_t mode); 49 | 50 | extern void become_root(void); 51 | extern void unbecome_root(void); 52 | extern int gmem(gid_t gid, int ngroups, gid_t *groups); 53 | extern int set_groups(AFPObj *obj, struct passwd *pwd); 54 | extern const char *print_groups(int ngroups, gid_t *groups); 55 | #endif /* ATALK_UNIX_H */ 56 | -------------------------------------------------------------------------------- /include/atalk/uuid.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008,2009 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef AFP_UUID_H 16 | #define AFP_UUID_H 17 | 18 | #define UUID_BINSIZE 16 19 | 20 | typedef const unsigned char *uuidp_t; 21 | typedef unsigned char atalk_uuid_t[UUID_BINSIZE]; 22 | 23 | typedef enum {UUID_USER = 1, 24 | UUID_GROUP = 2, 25 | UUID_ENOENT = 4} /* used as bit flag */ 26 | uuidtype_t; 27 | #define UUIDTYPESTR_MASK 3 28 | extern char *uuidtype[]; 29 | 30 | /******************************************************** 31 | * Interface 32 | ********************************************************/ 33 | 34 | extern int getuuidfromname( const char *name, uuidtype_t type, unsigned char *uuid); 35 | extern int getnamefromuuid( const unsigned char *uuid, char **name, uuidtype_t *type); 36 | extern void localuuid_from_id(unsigned char *buf, uuidtype_t type, unsigned int id); 37 | extern const char *uuid_bin2string(const unsigned char *uuid); 38 | extern void uuid_string2bin( const char *uuidstring, unsigned char *uuid); 39 | extern void uuidcache_dump(void); 40 | 41 | #endif /* AFP_UUID_H */ 42 | -------------------------------------------------------------------------------- /libatalk/acl/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/acl/ 2 | 3 | noinst_HEADERS = aclldap.h cache.h 4 | 5 | noinst_LTLIBRARIES = libacl.la 6 | libacl_la_SOURCES = cache.c unix.c uuid.c 7 | libacl_la_CFLAGS = 8 | libacl_la_LDFLAGS = 9 | libacl_la_LIBADD = @ACL_LIBS@ 10 | 11 | if HAVE_LDAP 12 | libacl_la_SOURCES += ldap.c ldap_config.c 13 | libacl_la_CFLAGS += @LDAP_CFLAGS@ 14 | libacl_la_LIBADD += @LDAP_LIBS@ 15 | libacl_la_LDFLAGS += @LDAP_LDFLAGS@ 16 | endif 17 | 18 | -------------------------------------------------------------------------------- /libatalk/acl/aclldap.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008,2009 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef ACLLDAP_H 16 | #define ACLLDAP_H 17 | 18 | #include /* just for uuidtype_t*/ 19 | 20 | /******************************************************** 21 | * Interface 22 | ********************************************************/ 23 | 24 | extern int ldap_getuuidfromname( const char *name, uuidtype_t type, char **uuid_string); 25 | extern int ldap_getnamefromuuid( const char *uuidstr, char **name, uuidtype_t *type); 26 | 27 | #endif /* ACLLDAP_H */ 28 | -------------------------------------------------------------------------------- /libatalk/acl/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2008,2009 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef LDAPCACHE_H 16 | #define LDAPCACHE_H 17 | 18 | /* 19 | * We need to cache all LDAP querie results, they just take too long. 20 | * We do hashing with chaining. Two caches are needed: 21 | * 1) name -> uuid, indexed by a hash(f(): hashstring) of the name 22 | * 2) uuid -> name, indexed by a hash of the uuid(f(): hashuuid) 23 | * Both hash funcs result in a value 0-255 with which we index a array. 24 | * We malloc and free all elements as needed. 25 | * The cache caches for CACHESECONDS. 26 | */ 27 | 28 | #define CACHESECONDS 600 29 | 30 | /******************************************************** 31 | * Interface 32 | ********************************************************/ 33 | 34 | extern int search_cachebyname( const char *name, uuidtype_t *type, unsigned char *uuid); 35 | extern int add_cachebyname( const char *inname, const uuidp_t inuuid, const uuidtype_t type, const unsigned long uid); 36 | extern int search_cachebyuuid( uuidp_t uuidp, char **name, uuidtype_t *type); 37 | extern int add_cachebyuuid( uuidp_t inuuid, const char *inname, uuidtype_t type, const unsigned long uid); 38 | 39 | #endif /* LDAPCACHE_H */ 40 | -------------------------------------------------------------------------------- /libatalk/adouble/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/adouble/ 2 | 3 | noinst_LTLIBRARIES = libadouble.la 4 | 5 | libadouble_la_SOURCES = \ 6 | ad_attr.c \ 7 | ad_conv.c \ 8 | ad_date.c \ 9 | ad_flush.c \ 10 | ad_lock.c \ 11 | ad_mmap.c \ 12 | ad_open.c \ 13 | ad_read.c \ 14 | ad_recvfile.c \ 15 | ad_sendfile.c \ 16 | ad_size.c \ 17 | ad_write.c 18 | 19 | noinst_HEADERS = ad_lock.h 20 | -------------------------------------------------------------------------------- /libatalk/adouble/ad_date.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif /* HAVE_CONFIG_H */ 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int ad_setdate(struct adouble *ad, 10 | unsigned int dateoff, uint32_t date) 11 | { 12 | int xlate = (dateoff & AD_DATE_UNIX); 13 | 14 | dateoff &= AD_DATE_MASK; 15 | if (xlate) 16 | date = AD_DATE_FROM_UNIX(date); 17 | 18 | if (!ad_getentryoff(ad, ADEID_FILEDATESI)) 19 | return -1; 20 | 21 | if (dateoff > AD_DATE_ACCESS) 22 | return -1; 23 | memcpy(ad_entry(ad, ADEID_FILEDATESI) + dateoff, &date, sizeof(date)); 24 | 25 | return 0; 26 | } 27 | 28 | int ad_getdate(const struct adouble *ad, 29 | unsigned int dateoff, uint32_t *date) 30 | { 31 | int xlate = (dateoff & AD_DATE_UNIX); 32 | 33 | dateoff &= AD_DATE_MASK; 34 | if (!ad_getentryoff(ad, ADEID_FILEDATESI)) 35 | return -1; 36 | 37 | if (dateoff > AD_DATE_ACCESS) 38 | return -1; 39 | memcpy(date, ad_entry(ad, ADEID_FILEDATESI) + dateoff, sizeof(uint32_t)); 40 | 41 | if (xlate) 42 | *date = AD_DATE_TO_UNIX(*date); 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /libatalk/adouble/ad_lock.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBATALK_ADOUBLE_AD_PRIVATE_H 2 | #define LIBATALK_ADOUBLE_AD_PRIVATE_H 1 3 | 4 | #include 5 | 6 | /* this is so that we can keep lists of fds referencing the same file 7 | * around. that way, we can honor locks created by the same process 8 | * with the same file. */ 9 | 10 | #define adf_lock_init(a) do { \ 11 | (a)->adf_lockmax = 0; \ 12 | (a)->adf_lockcount = 0; \ 13 | (a)->adf_lock = NULL; \ 14 | } while (0) 15 | 16 | #define adf_lock_free(a) do { \ 17 | int i; \ 18 | if (!(a)->adf_lock) \ 19 | break; \ 20 | for (i = 0; i < (a)->adf_lockcount; i++) { \ 21 | adf_lock_t *lock = (a)->adf_lock + i; \ 22 | if (--(*lock->refcount) < 1) \ 23 | free(lock->refcount); \ 24 | } \ 25 | free((a)->adf_lock); \ 26 | adf_lock_init(a); \ 27 | } while (0) 28 | 29 | #endif /* libatalk/adouble/ad_private.h */ 30 | -------------------------------------------------------------------------------- /libatalk/adouble/ad_size.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 4 | * All rights reserved. See COPYRIGHT. 5 | * 6 | * if we could depend upon inline functions, this would be one. 7 | */ 8 | 9 | #ifdef HAVE_CONFIG_H 10 | #include "config.h" 11 | #endif /* HAVE_CONFIG_H */ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | off_t ad_size(const struct adouble *ad, const uint32_t eid) 18 | { 19 | if (eid == ADEID_DFORK) { 20 | struct stat st; 21 | 22 | if (ad->ad_data_fork.adf_syml) 23 | return strlen(ad->ad_data_fork.adf_syml); 24 | 25 | if (fstat(ad_data_fileno(ad), &st) < 0) 26 | return 0; 27 | return st.st_size; 28 | } 29 | #if 0 30 | return ad_getentrylen(ad, eid); 31 | #endif 32 | return ad->ad_rlen; 33 | } 34 | -------------------------------------------------------------------------------- /libatalk/bstring/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/adouble/ 2 | 3 | noinst_LTLIBRARIES = libbstring.la 4 | 5 | libbstring_la_SOURCES = bstrlib.c bstradd.c 6 | 7 | -------------------------------------------------------------------------------- /libatalk/cnid/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/cnid/ 2 | 3 | SUBDIRS = last cdb dbd tdb 4 | 5 | noinst_LTLIBRARIES = libcnid.la 6 | LIBCNID_DEPS = dbd/libcnid_dbd.la 7 | 8 | if USE_CDB_BACKEND 9 | LIBCNID_DEPS += cdb/libcnid_cdb.la 10 | endif 11 | 12 | if USE_LAST_BACKEND 13 | LIBCNID_DEPS += last/libcnid_last.la 14 | endif 15 | 16 | if USE_TDB_BACKEND 17 | LIBCNID_DEPS += tdb/libcnid_tdb.la 18 | endif 19 | 20 | if USE_MYSQL_BACKEND 21 | SUBDIRS += mysql 22 | LIBCNID_DEPS += @MYSQL_LIBS@ mysql/libcnid_mysql.la 23 | endif 24 | 25 | libcnid_la_SOURCES = cnid.c cnid_init.c 26 | libcnid_la_LIBADD = $(LIBCNID_DEPS) 27 | 28 | EXTRA_DIST = README 29 | 30 | -------------------------------------------------------------------------------- /libatalk/cnid/README: -------------------------------------------------------------------------------- 1 | 2 | CNID back-end refactoring 3 | 4 | This patch allows to compile all DID schemes into 5 | afpd binary and then select desired schemes at runtime, 6 | per volume. 7 | 8 | 9 | Changes: 10 | 11 | Libatalk/cnid directory as been restructured. Now it contains 12 | subdirectories representing particular back-end types and a 13 | simple cnid-object factory (cnid.c and cnid_init.c). 14 | 15 | All CNID functions have been grouped into a structure which 16 | contains function pointers and some data. Main afpd code uses 17 | them in a object manner rather than structural: it calls cnid 18 | functions through fields of cnid_db structure. 19 | 20 | Actually there are standard backends: transactional db3, cdb, 21 | last and mtab (I'm not sure how to call mtab - it does some magic 22 | with dev/inode numbers, but mtab has been removed some time ago). 23 | 24 | Changes in ./configure options: 25 | 26 | Options --with-did=xxx, --with-cdb have been removed. 27 | 28 | Instead, there are following options: 29 | --with-cnid-cdb-backend - compile DB3 Concurrent Datastore backend 30 | --with-cnid-db3-backend - compile DB3 transactional backend 31 | --with-cnid-last-backend - compile LAST backend 32 | --with-cnid-mtab-backend - compile MTAB backend 33 | --with-cnid-default-backend={cdb|db3|last|mtab} 34 | 35 | Some of the backend names should be (propably) changed (mtab? db3?). 36 | 37 | AppleVolumes.default file has a new option: -cnidscheme:{db3|cdb|last|mtab} 38 | 39 | Again, sorry for this weird naming. I didn't care about it while coding, 40 | some cleanups have to be done later. 41 | 42 | Was tested mainly against test-suite and against MacOS 9 client. 43 | 44 | Things to do: 45 | - some really reliable kind of backend should be developed 46 | - file-name mangling should be runtime option 47 | - naming- and code cleanups are still needed 48 | - optional dynamic CNID backend loading - lower priority, static linking 49 | option has still to be available 50 | 51 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/cnid/ 2 | 3 | libcnid_cdb_la_SOURCES = cnid_cdb_add.c \ 4 | cnid_cdb_close.c \ 5 | cnid_cdb_delete.c \ 6 | cnid_cdb_get.c \ 7 | cnid_cdb_lookup.c \ 8 | cnid_cdb_open.c \ 9 | cnid_cdb_resolve.c \ 10 | cnid_cdb_update.c \ 11 | cnid_cdb_rebuild_add.c \ 12 | cnid_cdb.h 13 | libcnid_cdb_la_CFLAGS = @BDB_CFLAGS@ 14 | libcnid_cdb_la_LIBADD = @BDB_LIBS@ @PTHREAD_LIBS@ 15 | 16 | if USE_CDB_BACKEND 17 | noinst_LTLIBRARIES = libcnid_cdb.la 18 | endif 19 | 20 | noinst_HEADERS = cnid_cdb_meta.h cnid_cdb_private.h 21 | EXTRA_DIST = README cnid_cdb_meta.c cnid_cdb_nextid.c 22 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/README: -------------------------------------------------------------------------------- 1 | the catalog database keeps track of three mappings: 2 | CNID -> dev/ino and did/name 3 | dev/ino -> CNID 4 | did/name -> CNID 5 | 6 | dev/ino is used to keep track of magically moved files. did/name is 7 | for quick lookups of CNIDs. 8 | 9 | NOTE: the database will append a nul byte to the end of name. in 10 | addition, name should be given as it appears on disk. this allows the 11 | creation of cnid updating/cleaning programs that don't have to deal 12 | with knowing what the particular codepage is. 13 | 14 | here's the ritual: 15 | 1) open a volume. call cnid_open. 16 | 2) every time you need a CNID, call cnid_add(). it will 17 | automatically look for an existing cnid and add a new one 18 | if one isn't already there. you can pass a hint if you 19 | want. the only use this has right now is to enable 20 | consistency between AFP and HFS. in the future, it would 21 | allow people to write conversion utilities that 22 | pre-instantiate a database without needing to re-assign 23 | CNIDs. 24 | 3) if you want to just look for a CNID without automatically 25 | adding one in, you have two choices: 26 | a) cnid_resolve takes a CNID, returns name, and 27 | over-writes the CNID given with the parent DID. this 28 | is good for FPResolveID. 29 | b) cnid_lookup returns a CNID corresponding to the 30 | dev/ino,did/name keys. it will auto-update the catalog 31 | database if there's a discrepancy. 32 | NOTE: cnid_add calls this before adding a new CNID. 33 | 4) when you delete a file or directory, you need to call 34 | cnid_delete with the CNID for that file/directory. 35 | 5) call cnid_close when closing the volume. 36 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * interface for database access to cnids. i do it this way to abstract 3 | * things a bit in case we want to change the underlying implementation. 4 | */ 5 | 6 | #ifndef _ATALK_CNID_CDB__H 7 | #define _ATALK_CNID_CDB__H 1 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | /* cnid_open.c */ 16 | extern struct _cnid_module cnid_cdb_module; 17 | extern struct _cnid_db *cnid_cdb_open (struct cnid_open_args *args); 18 | 19 | /* cnid_close.c */ 20 | extern void cnid_cdb_close (struct _cnid_db *); 21 | 22 | /* cnid_add.c */ 23 | extern cnid_t cnid_cdb_add (struct _cnid_db *, const struct stat *, cnid_t, 24 | const char *, size_t, cnid_t); 25 | extern int cnid_cdb_getstamp (struct _cnid_db *, void *, const size_t ); 26 | 27 | /* cnid_get.c */ 28 | extern cnid_t cnid_cdb_get (struct _cnid_db *, cnid_t, const char *, size_t); 29 | extern char *cnid_cdb_resolve (struct _cnid_db *, cnid_t *, void *, size_t ); 30 | extern cnid_t cnid_cdb_lookup (struct _cnid_db *, const struct stat *, cnid_t, 31 | const char *, size_t); 32 | 33 | /* cnid_update.c */ 34 | extern int cnid_cdb_update (struct _cnid_db *, cnid_t, const struct stat *, 35 | cnid_t, const char *, size_t); 36 | 37 | /* cnid_delete.c */ 38 | extern int cnid_cdb_delete (struct _cnid_db *, const cnid_t); 39 | 40 | /* cnid_nextid.c */ 41 | extern cnid_t cnid_cdb_nextid (struct _cnid_db *); 42 | 43 | extern int cnid_cdb_lock (void *); 44 | extern int cnid_cdb_unlock (void *); 45 | 46 | extern cnid_t cnid_cdb_rebuild_add (struct _cnid_db *, const struct stat *, 47 | cnid_t, const char *, size_t, cnid_t); 48 | 49 | 50 | #endif /* include/atalk/cnid_cdb.h */ 51 | 52 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb_close.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif /* HAVE_CONFIG_H */ 7 | 8 | #ifdef CNID_BACKEND_CDB 9 | #include "cnid_cdb_private.h" 10 | 11 | void cnid_cdb_close(struct _cnid_db *cdb) { 12 | CNID_private *db; 13 | 14 | if (!cdb) { 15 | LOG(log_error, logtype_afpd, "cnid_close called with NULL argument !"); 16 | return; 17 | } 18 | 19 | if (!(db = cdb->cnid_db_private)) { 20 | return; 21 | } 22 | db->db_didname->sync(db->db_didname, 0); 23 | db->db_devino->sync(db->db_devino, 0); 24 | db->db_cnid->sync(db->db_cnid, 0); 25 | 26 | db->db_didname->close(db->db_didname, 0); 27 | db->db_devino->close(db->db_devino, 0); 28 | db->db_cnid->close(db->db_cnid, 0); 29 | 30 | db->dbenv->close(db->dbenv, 0); 31 | 32 | free(db); 33 | free(cdb); 34 | } 35 | 36 | #endif /* CNID_BACKEND_CDB */ 37 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb_delete.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1999. Adrian Sun (asun@zoology.washington.edu) 4 | * All Rights Reserved. See COPYRIGHT. 5 | * 6 | * cnid_delete: delete a CNID from the database 7 | */ 8 | 9 | #ifdef HAVE_CONFIG_H 10 | #include "config.h" 11 | #endif /* HAVE_CONFIG_H */ 12 | 13 | #ifdef CNID_BACKEND_CDB 14 | #include 15 | #include "cnid_cdb_private.h" 16 | 17 | #define tid NULL 18 | 19 | int cnid_cdb_delete(struct _cnid_db *cdb, const cnid_t id) { 20 | CNID_private *db; 21 | DBT key; 22 | int rc; 23 | 24 | if (!cdb || !(db = cdb->cnid_db_private) || !id || (db->flags & CNIDFLAG_DB_RO)) { 25 | return -1; 26 | } 27 | 28 | memset(&key, 0, sizeof(key)); 29 | 30 | /* Get from ain CNID database. */ 31 | key.data = (cnid_t *)&id; 32 | key.size = sizeof(id); 33 | 34 | if ((rc = db->db_cnid->del(db->db_cnid, tid, &key, 0))) { 35 | LOG(log_error, logtype_default, "cnid_delete: Unable to delete CNID %u: %s", 36 | ntohl(id), db_strerror(rc)); 37 | } 38 | else { 39 | #ifdef DEBUG 40 | LOG(log_debug9, logtype_default, "cnid_delete: Deleting CNID %u", ntohl(id)); 41 | #endif 42 | } 43 | return rc; 44 | } 45 | 46 | #endif /* CNID_BACKEND_CDB */ 47 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb_get.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif /* HAVE_CONFIG_H */ 4 | 5 | #ifdef CNID_BACKEND_CDB 6 | #include "cnid_cdb_private.h" 7 | 8 | /* Return CNID for a given did/name. */ 9 | cnid_t cnid_cdb_get(struct _cnid_db *cdb, cnid_t did, const char *name, size_t len) 10 | { 11 | char start[CNID_DID_LEN + MAXPATHLEN + 1], *buf; 12 | CNID_private *db; 13 | DBT key, data; 14 | cnid_t id; 15 | int rc; 16 | 17 | if (!cdb || !(db = cdb->cnid_db_private) || (len > MAXPATHLEN)) { 18 | return 0; 19 | } 20 | 21 | memset(&key, 0, sizeof(key)); 22 | memset(&data, 0, sizeof(data)); 23 | 24 | buf = start; 25 | memcpy(buf, &did, sizeof(did)); 26 | buf += sizeof(did); 27 | memcpy(buf, name, len); 28 | *(buf + len) = '\0'; /* Make it a C-string. */ 29 | key.data = start; 30 | key.size = CNID_DID_LEN + len + 1; 31 | 32 | while ((rc = db->db_didname->get(db->db_didname, NULL, &key, &data, 0))) { 33 | 34 | if (rc != DB_NOTFOUND) { 35 | LOG(log_error, logtype_default, "cnid_get: Unable to get CNID %u, name %s: %s", 36 | ntohl(did), name, db_strerror(rc)); 37 | } 38 | 39 | return 0; 40 | } 41 | 42 | memcpy(&id, data.data, sizeof(id)); 43 | #ifdef DEBUG 44 | LOG(log_debug9, logtype_default, "cnid_get: Returning CNID for %u, name %s as %u", 45 | ntohl(did), name, ntohl(id)); 46 | #endif 47 | return id; 48 | } 49 | 50 | #endif /* CNID_BACKEND_CDB */ 51 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb_meta.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1999. Adrian Sun (asun@zoology.washington.edu) 4 | * All Rights Reserved. See COPYRIGHT. 5 | * 6 | * deal with metadata 7 | * 8 | */ 9 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb_meta.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #define CNID_META_CNID_LEN 4 5 | #define CNID_META_MDATE_LEN 4 /* space for 8 */ 6 | #define CNID_META_CDATE_LEN 4 /* space for 8 */ 7 | #define CNID_META_BDATE_LEN 4 /* ditto */ 8 | #define CNID_META_ADATE_LEN 4 /* ditto */ 9 | #define CNID_META_AFPI_LEN 4 /* plus permission bits */ 10 | #define CNID_META_FINDERI_LEN 32 11 | #define CNID_META_PRODOSI_LEN 8 12 | #define CNID_META_RFORKLEN_LEN 4 /* space for 8 */ 13 | #define CNID_META_MACNAME_LEN 32 /* maximum size */ 14 | #define CNID_META_SHORTNAME_LEN 12 /* max size (8.3) */ 15 | #define CNID_META_FILLER_LEN 4 16 | 17 | #define CNID_META_CNID_OFF 0 18 | #define CNID_META_MDATE_OFF (CNID_META_CNID_OFF + CNID_META_CNID_LEN + \ 19 | CNID_META_FILLER_LEN) 20 | #define CNID_META_CDATE_OFF (CNID_META_MDATE_OFF + CNID_META_MDATE_LEN + \ 21 | CNID_META_FILLER_LEN) 22 | #define CNID_META_BDATE_OFF (CNID_META_CDATE_OFF + CNID_META_CDATE_LEN + \ 23 | CNID_META_FILLER_LEN) 24 | #define CNID_META_ADATE_OFF (CNID_META_BDATE_OFF + CNID_META_BDATE_LEN + \ 25 | CNID_META_FILLER_LEN) 26 | #define CNID_META_AFPI_OFF (CNID_META_ADATE_OFF + CNID_META_ADATE_LEN) 27 | #define CNID_META_FINDERI_OFF (CNID_META_AFPI_OFF + CNID_META_AFPI_LEN) 28 | #define CNID_META_PRODOSI_OFF (CNID_META_FINDERI_OFF + CNID_META_FINDERI_LEN) 29 | #define CNID_META_RFORKLEN_OFF (CNID_META_PRODOSI_OFF + CNID_META_PRODOSI_LEN) 30 | #define CNID_META_MACNAME_OFF (CNID_META_RFORKLEN_OFF + \ 31 | CNID_META_RFORKLEN_LEN) 32 | #define CNID_META_SHORTNAME_OFF (CNID_META_MACNAME_OFF + 33 | 34 | 35 | #define cnid_meta_clear(a) 36 | #define cnid_meta_get(id) 37 | 38 | #define cnid_meta_cnid(a) 39 | #define cnid_meta_modifydate(a) 40 | #define cnid_meta_createdate(a) 41 | #define cnid_meta_backupdate(a) 42 | #define cnid_meta_accessdate(a) 43 | #define cnid_meta_afpi(a) 44 | #define cnid_meta_finderi(a) 45 | #define cnid_meta_prodosi(a) 46 | #define cnid_meta_rforklen(a) 47 | #define cnid_meta_macname(a) 48 | #define cnid_meta_shortname(a) 49 | #define cnid_meta_longname(a) 50 | 51 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb_nextid.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif /* HAVE_CONFIG_H */ 7 | 8 | #ifdef CNID_BACKEND_CDB 9 | 10 | #ifdef unused 11 | #include "cnid_cdb_private.h" 12 | 13 | /* return the next id. we use the fact that ad files are memory 14 | * mapped. */ 15 | cnid_t cnid_cdb_nextid(struct _cnid_db *cdb) 16 | { 17 | CNID_private *db; 18 | cnid_t id; 19 | 20 | if (!cdb || !(db = cdb->_private)) 21 | return 0; 22 | 23 | memcpy(&id, ad_entry(&db->rootinfo, ADEID_DID), sizeof(id)); 24 | return id; 25 | } 26 | #endif 27 | 28 | #endif /* CNID_BACKEND_CDB */ 29 | -------------------------------------------------------------------------------- /libatalk/cnid/cdb/cnid_cdb_resolve.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif /* HAVE_CONFIG_H */ 7 | 8 | #ifdef CNID_BACKEND_CDB 9 | #include "cnid_cdb_private.h" 10 | 11 | /* Return the did/name pair corresponding to a CNID. */ 12 | char *cnid_cdb_resolve(struct _cnid_db *cdb, cnid_t *id, void *buffer, size_t len) { 13 | CNID_private *db; 14 | DBT key, data; 15 | int rc; 16 | 17 | if (!cdb || !(db = cdb->cnid_db_private) || !id || !(*id)) { 18 | return NULL; 19 | } 20 | 21 | memset(&key, 0, sizeof(key)); 22 | memset(&data, 0, sizeof(data)); 23 | 24 | data.data = buffer; 25 | data.ulen = len; 26 | data.flags = DB_DBT_USERMEM; 27 | 28 | key.data = id; 29 | key.size = sizeof(cnid_t); 30 | while ((rc = db->db_cnid->get(db->db_cnid, NULL, &key, &data, 0))) { 31 | 32 | if (rc != DB_NOTFOUND) { 33 | LOG(log_error, logtype_default, "cnid_resolve: Unable to get did/name: %s", 34 | db_strerror(rc)); 35 | } 36 | 37 | *id = 0; 38 | return NULL; 39 | } 40 | 41 | memcpy(id, (char *)data.data +CNID_DID_OFS, sizeof(cnid_t)); 42 | #ifdef DEBUG 43 | LOG(log_debug9, logtype_default, "cnid_resolve: Returning id = %u, did/name = %s", 44 | ntohl(*id), (char *)data.data + CNID_NAME_OFS); 45 | #endif 46 | return (char *)data.data + CNID_NAME_OFS; 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /libatalk/cnid/dbd/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/cnid/ 2 | 3 | noinst_LTLIBRARIES = libcnid_dbd.la 4 | 5 | libcnid_dbd_la_SOURCES = cnid_dbd.c cnid_dbd.h 6 | 7 | -------------------------------------------------------------------------------- /libatalk/cnid/dbd/cnid_dbd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) Joerg Lenneis 2003 3 | * Copyright (C) Frank Lahm 2010 4 | * All Rights Reserved. See COPYING. 5 | */ 6 | 7 | 8 | #ifndef _ATALK_CNID_DBD__H 9 | #define _ATALK_CNID_DBD__H 1 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | extern struct _cnid_module cnid_dbd_module; 19 | extern struct _cnid_db *cnid_dbd_open (struct cnid_open_args *args); 20 | extern void cnid_dbd_close (struct _cnid_db *); 21 | extern cnid_t cnid_dbd_add (struct _cnid_db *, const struct stat *, cnid_t, 22 | const char *, size_t, cnid_t); 23 | extern cnid_t cnid_dbd_get (struct _cnid_db *, cnid_t, const char *, size_t); 24 | extern char *cnid_dbd_resolve (struct _cnid_db *, cnid_t *, void *, size_t ); 25 | extern int cnid_dbd_getstamp (struct _cnid_db *, void *, const size_t ); 26 | extern cnid_t cnid_dbd_lookup (struct _cnid_db *, const struct stat *, cnid_t, 27 | const char *, size_t); 28 | extern int cnid_dbd_find (struct _cnid_db *cdb, const char *name, size_t namelen, 29 | void *buffer, size_t buflen); 30 | extern int cnid_dbd_update (struct _cnid_db *, cnid_t, const struct stat *, 31 | cnid_t, const char *, size_t); 32 | extern int cnid_dbd_delete (struct _cnid_db *, const cnid_t); 33 | extern cnid_t cnid_dbd_rebuild_add(struct _cnid_db *, const struct stat *, 34 | cnid_t, const char *, size_t, cnid_t); 35 | extern int cnid_dbd_wipe (struct _cnid_db *cdb); 36 | /* FIXME: These functions could be static in cnid_dbd.c */ 37 | 38 | #endif /* include/atalk/cnid_dbd.h */ 39 | 40 | -------------------------------------------------------------------------------- /libatalk/cnid/last/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/cnid/ 2 | 3 | if USE_LAST_BACKEND 4 | noinst_LTLIBRARIES = libcnid_last.la 5 | endif 6 | 7 | libcnid_last_la_SOURCES = cnid_last.c \ 8 | cnid_last.h 9 | 10 | EXTRA_DIST = README 11 | -------------------------------------------------------------------------------- /libatalk/cnid/last/README: -------------------------------------------------------------------------------- 1 | This is [last] DID scheme implementation. 2 | 3 | TODO: this scheme doesn't exactly mimic real, persistent CNID schemes, so 4 | things like name mangling won't work. 5 | -------------------------------------------------------------------------------- /libatalk/cnid/last/cnid_last.h: -------------------------------------------------------------------------------- 1 | /* 2 | * interface for database access to cnids. i do it this way to abstract 3 | * things a bit in case we want to change the underlying implementation. 4 | */ 5 | 6 | #ifndef _ATALK_CNID_LAST__H 7 | #define _ATALK_CNID_LAST__H 1 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | struct _cnid_last_private { 16 | cnid_t last_did; 17 | }; 18 | 19 | extern struct _cnid_module cnid_last_module; 20 | extern struct _cnid_db *cnid_last_open (struct cnid_open_args *args); 21 | extern void cnid_last_close (struct _cnid_db *); 22 | extern cnid_t cnid_last_add (struct _cnid_db *, const struct stat *, cnid_t, 23 | const char *, size_t, cnid_t); 24 | extern cnid_t cnid_last_get (struct _cnid_db *, cnid_t, const char *, size_t); 25 | extern char *cnid_last_resolve (struct _cnid_db *, cnid_t *, void *, size_t); 26 | extern cnid_t cnid_last_lookup (struct _cnid_db *, const struct stat *, cnid_t, const char *, size_t); 27 | extern int cnid_last_update (struct _cnid_db *, cnid_t, const struct stat *, 28 | cnid_t, const char *, size_t); 29 | extern int cnid_last_delete (struct _cnid_db *, cnid_t); 30 | 31 | #endif /* include/atalk/cnid_last.h */ 32 | -------------------------------------------------------------------------------- /libatalk/cnid/mysql/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/cnid/mysql/ 2 | 3 | noinst_LTLIBRARIES = libcnid_mysql.la 4 | libcnid_mysql_la_SOURCES = cnid_mysql.c 5 | libcnid_mysql_la_CFLAGS = @MYSQL_CFLAGS@ 6 | libcnid_mysql_la_LIBADD = @MYSQL_LIBS@ 7 | -------------------------------------------------------------------------------- /libatalk/cnid/tdb/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/cnid/ 2 | 3 | if USE_TDB_BACKEND 4 | noinst_LTLIBRARIES = libcnid_tdb.la 5 | endif 6 | 7 | libcnid_tdb_la_SOURCES = cnid_tdb_add.c \ 8 | cnid_tdb_close.c \ 9 | cnid_tdb_delete.c \ 10 | cnid_tdb_get.c \ 11 | cnid_tdb_lookup.c \ 12 | cnid_tdb_open.c \ 13 | cnid_tdb_resolve.c \ 14 | cnid_tdb_update.c \ 15 | cnid_tdb.h 16 | 17 | libcnid_tdb_la_CFLAGS = @TDB_CFLAGS@ 18 | libcnid_tdb_la_LIBADD = @TDB_LIBS@ 19 | 20 | EXTRA_DIST = README cnid_tdb_nextid.c 21 | -------------------------------------------------------------------------------- /libatalk/cnid/tdb/README: -------------------------------------------------------------------------------- 1 | the catalog database keeps track of three mappings: 2 | CNID -> dev/ino and did/name 3 | dev/ino -> CNID 4 | did/name -> CNID 5 | 6 | dev/ino is used to keep track of magically moved files. did/name is 7 | for quick lookups of CNIDs. 8 | 9 | NOTE: the database will append a nul byte to the end of name. in 10 | addition, name should be given as it appears on disk. this allows the 11 | creation of cnid updating/cleaning programs that don't have to deal 12 | with knowing what the particular codepage is. 13 | 14 | here's the ritual: 15 | 1) open a volume. call cnid_open. 16 | 2) every time you need a CNID, call cnid_add(). it will 17 | automatically look for an existing cnid and add a new one 18 | if one isn't already there. you can pass a hint if you 19 | want. the only use this has right now is to enable 20 | consistency between AFP and HFS. in the future, it would 21 | allow people to write conversion utilities that 22 | pre-instantiate a database without needing to re-assign 23 | CNIDs. 24 | 3) if you want to just look for a CNID without automatically 25 | adding one in, you have two choices: 26 | a) cnid_resolve takes a CNID, returns name, and 27 | over-writes the CNID given with the parent DID. this 28 | is good for FPResolveID. 29 | b) cnid_lookup returns a CNID corresponding to the 30 | dev/ino,did/name keys. it will auto-update the catalog 31 | database if there's a discrepancy. 32 | NOTE: cnid_add calls this before adding a new CNID. 33 | 4) when you delete a file or directory, you need to call 34 | cnid_delete with the CNID for that file/directory. 35 | 5) call cnid_close when closing the volume. 36 | -------------------------------------------------------------------------------- /libatalk/cnid/tdb/cnid_tdb_close.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif 7 | 8 | #ifdef CNID_BACKEND_TDB 9 | 10 | #include "cnid_tdb.h" 11 | 12 | void cnid_tdb_close(struct _cnid_db *cdb) 13 | { 14 | struct _cnid_tdb_private *db; 15 | 16 | db = (struct _cnid_tdb_private *)cdb->cnid_db_private; 17 | tdb_close(db->tdb_cnid); 18 | free(cdb->cnid_db_private); 19 | free(cdb); 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libatalk/cnid/tdb/cnid_tdb_delete.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1999. Adrian Sun (asun@zoology.washington.edu) 4 | * All Rights Reserved. See COPYRIGHT. 5 | * 6 | * cnid_delete: delete a CNID from the database 7 | */ 8 | 9 | #ifdef HAVE_CONFIG_H 10 | #include "config.h" 11 | #endif 12 | 13 | #ifdef CNID_BACKEND_TDB 14 | 15 | #include "cnid_tdb.h" 16 | 17 | int cnid_tdb_delete(struct _cnid_db *cdb, const cnid_t id) 18 | { 19 | struct _cnid_tdb_private *db; 20 | TDB_DATA key, data; 21 | 22 | if (!cdb || !(db = cdb->cnid_db_private) || !id) { 23 | return -1; 24 | } 25 | memset(&key, 0, sizeof(key)); 26 | memset(&data, 0, sizeof(data)); 27 | 28 | key.dptr = (unsigned char *)&id; 29 | key.dsize = sizeof(cnid_t); 30 | data = tdb_fetch(db->tdb_cnid, key); 31 | if (!data.dptr) 32 | { 33 | return 0; 34 | } 35 | 36 | tdb_delete(db->tdb_cnid, key); 37 | 38 | key.dptr = data.dptr +CNID_DEVINO_OFS; 39 | key.dsize = CNID_DEVINO_LEN; 40 | tdb_delete(db->tdb_devino, key); 41 | 42 | key.dptr = data.dptr +CNID_DID_OFS; 43 | key.dsize = data.dsize -CNID_DID_OFS; 44 | tdb_delete(db->tdb_didname, key); 45 | 46 | free(data.dptr); 47 | return 0; 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libatalk/cnid/tdb/cnid_tdb_get.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif 4 | 5 | #ifdef CNID_BACKEND_TDB 6 | 7 | #include "cnid_tdb.h" 8 | 9 | /* Return CNID for a given did/name. */ 10 | cnid_t cnid_tdb_get(struct _cnid_db *cdb, cnid_t did, const char *name, size_t len) 11 | { 12 | char start[CNID_DID_LEN + MAXPATHLEN + 1], *buf; 13 | struct _cnid_tdb_private *db; 14 | TDB_DATA key, data; 15 | cnid_t id; 16 | 17 | if (!cdb || !(db = cdb->cnid_db_private) || (len > MAXPATHLEN)) { 18 | return 0; 19 | } 20 | 21 | memset(&key, 0, sizeof(key)); 22 | memset(&data, 0, sizeof(data)); 23 | 24 | buf = start; 25 | memcpy(buf, &did, sizeof(did)); 26 | buf += sizeof(did); 27 | memcpy(buf, name, len); 28 | *(buf + len) = '\0'; /* Make it a C-string. */ 29 | key.dptr = (unsigned char *)start; 30 | key.dsize = CNID_DID_LEN + len + 1; 31 | data = tdb_fetch(db->tdb_didname, key); 32 | if (!data.dptr) 33 | return 0; 34 | 35 | memcpy(&id, data.dptr, sizeof(id)); 36 | free(data.dptr); 37 | return id; 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /libatalk/cnid/tdb/cnid_tdb_nextid.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif 7 | 8 | #ifdef CNID_BACKEND_TDB 9 | 10 | #include "cnid_tdb.h" 11 | 12 | cnid_t cnid_tdb_nextid(struct _cnid_db *cdb) 13 | { 14 | return CNID_INVALID; 15 | } 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /libatalk/cnid/tdb/cnid_tdb_resolve.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif 7 | 8 | #ifdef CNID_BACKEND_TDB 9 | 10 | #include "cnid_tdb.h" 11 | 12 | /* Return the did/name pair corresponding to a CNID. */ 13 | char *cnid_tdb_resolve(struct _cnid_db *cdb, cnid_t * id, void *buffer, size_t len) 14 | { 15 | struct _cnid_tdb_private *db; 16 | TDB_DATA key, data; 17 | 18 | if (!cdb || !(db = cdb->cnid_db_private) || !id || !(*id)) { 19 | return NULL; 20 | } 21 | key.dptr = (unsigned char *)id; 22 | key.dsize = sizeof(cnid_t); 23 | data = tdb_fetch(db->tdb_cnid, key); 24 | if (data.dptr) 25 | { 26 | if (data.dsize < len && data.dsize > sizeof(cnid_t)) { 27 | memcpy(id, (char *)data.dptr + +CNID_DID_OFS, sizeof(cnid_t)); 28 | strcpy(buffer, (char *)data.dptr + CNID_NAME_OFS); 29 | free(data.dptr); 30 | return buffer; 31 | } 32 | free(data.dptr); 33 | } 34 | return NULL; 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /libatalk/compat/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/compat/ 2 | 3 | noinst_LTLIBRARIES = libcompat.la 4 | 5 | libcompat_la_SOURCES = \ 6 | misc.c \ 7 | mktemp.c \ 8 | getusershell.c \ 9 | rquota_xdr.c \ 10 | pselect.c \ 11 | strlcpy.c 12 | -------------------------------------------------------------------------------- /libatalk/compat/misc.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif /* HAVE_CONFIG_H */ 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #if !defined HAVE_DIRFD && defined SOLARIS 11 | #include 12 | int dirfd(DIR *dir) 13 | { 14 | return dir->d_fd; 15 | } 16 | #endif 17 | 18 | #ifndef HAVE_STRNLEN 19 | size_t strnlen(const char *s, size_t max) 20 | { 21 | size_t len; 22 | 23 | for (len = 0; len < max; len++) { 24 | if (s[len] == '\0') { 25 | break; 26 | } 27 | } 28 | return len; 29 | } 30 | #endif 31 | 32 | #ifndef HAVE_VASPRINTF 33 | int vasprintf(char **ret, const char *fmt, va_list ap) 34 | { 35 | int n, size = 64; 36 | char *p, *np; 37 | 38 | if ((p = malloc(size)) == NULL) 39 | return NULL; 40 | 41 | while (1) { 42 | /* Try to print in the allocated space. */ 43 | n = vsnprintf(p, size, fmt, ap); 44 | /* If that worked, return the string. */ 45 | if (n > -1 && n < size) { 46 | *ret = p; 47 | return n; 48 | } 49 | /* Else try again with more space. */ 50 | if (n > -1) /* glibc 2.1 */ 51 | size = n+1; /* precisely what is needed */ 52 | else /* glibc 2.0 */ 53 | size *= 2; /* twice the old size */ 54 | if ((np = realloc (p, size)) == NULL) { 55 | free(p); 56 | *ret = NULL; 57 | return -1; 58 | } else { 59 | p = np; 60 | } 61 | } 62 | } 63 | #endif 64 | 65 | #ifndef HAVE_ASPRINTF 66 | int asprintf(char **strp, const char *fmt, ...) 67 | { 68 | va_list ap; 69 | int len; 70 | 71 | va_start(ap, fmt); 72 | len = vasprintf(strp, fmt, ap); 73 | va_end(ap); 74 | 75 | return len; 76 | } 77 | #endif 78 | -------------------------------------------------------------------------------- /libatalk/dsi/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/dsi/ 2 | 3 | INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/sys 4 | 5 | LIBS = @LIBS@ 6 | 7 | noinst_LTLIBRARIES = libdsi.la 8 | 9 | libdsi_la_SOURCES = dsi_attn.c dsi_close.c dsi_cmdreply.c dsi_getsess.c dsi_getstat.c dsi_init.c dsi_opensess.c dsi_read.c dsi_tcp.c dsi_tickle.c dsi_write.c dsi_stream.c 10 | -------------------------------------------------------------------------------- /libatalk/dsi/README: -------------------------------------------------------------------------------- 1 | SIGNALS AND WRITES TO CLIENT: 2 | because AFP/TCP uses a streaming protocol, we need to make sure that 3 | writes to the client are atomic. notably, signal handlers which write 4 | data can't interrupt data currently being written. in addition, some 5 | functions get called from the signal handlers or can write partial 6 | packets. we need to SIG_BLOCK/SIG_SETMASK those functions instead of 7 | SIG_BLOCK/SIG_UNBLOCK'ing them. furthermore, certain functions which 8 | write to the client can get called at any time. to avoid corruption, 9 | we need to make sure that these functions DO NOT touch any common-use 10 | buffers. 11 | 12 | signals that send data to the client and should block other signals 13 | (afp_dsi.c): 14 | SIGALRM (tickle handler) 15 | SIGHUP (attention) 16 | SIGTERM (attention) 17 | 18 | functions which need SIG_BLOCK/SIG_SETMASK: dsi_send, dsi_attention 19 | functions which can use SIG_BLOCK/SIG_UNBLOCK: dsi_read 20 | 21 | functions which need their own buffers: dsi_attention, dsi_tickle 22 | 23 | 24 | PERFORMANCE TWEAKING: 25 | sending complete packets or the header and a partial packet to the 26 | client should always be handled by proto_send. for dsi_tcp.c, 27 | proto_send will coalesce the header and data by using writev. 28 | in addition, appleshare sessions often involve 29 | the sending and receiving of many small packets. as a consequence, i 30 | use TCP_NODELAY to speed up the turnaround time. 31 | 32 | because dsi_read can send incomplete packets, proto_send should not 33 | use the length parameter to specify the dsi_len field in the 34 | header. instead, anything that uses proto_send needs to specify 35 | dsi_len (in network byte order) before calling proto_send. the 36 | dsi_send() macro already does this. 37 | 38 | functions that need to specify .dsi_len: dsi_readinit, dsi_cmdreply 39 | 40 | mmap doesn't actually help things that much, so i don't use it. 41 | 42 | to reduce the amount of tickles generated on a slow link, i actually 43 | turn off SIGALRM for the duration of a "known" large file transfer 44 | (i.e., dsi_read/write). 45 | 46 | -------------------------------------------------------------------------------- /libatalk/dsi/dsi_attn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 4 | * All rights reserved. See COPYRIGHT. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | #ifndef MIN 21 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) 22 | #endif /* MIN */ 23 | 24 | /* send an attention. this may get called at any time, so we can't use 25 | * DSI buffers to send one. 26 | return 0 on error 27 | 28 | */ 29 | int dsi_attention(DSI *dsi, AFPUserBytes flags) 30 | { 31 | /* header + AFPUserBytes */ 32 | char block[DSI_BLOCKSIZ + sizeof(AFPUserBytes)]; 33 | uint32_t len, nlen; 34 | uint16_t id; 35 | 36 | if (dsi->flags & DSI_SLEEPING) 37 | return 1; 38 | 39 | if (dsi->in_write) { 40 | return -1; 41 | } 42 | id = htons(dsi_serverID(dsi)); 43 | flags = htons(flags); 44 | len = MIN(sizeof(flags), dsi->attn_quantum); 45 | nlen = htonl(len); 46 | 47 | memset(block, 0, sizeof(block)); 48 | block[0] = DSIFL_REQUEST; /* sending a request */ 49 | block[1] = DSIFUNC_ATTN; /* it's an attention */ 50 | memcpy(block + 2, &id, sizeof(id)); 51 | /* code = 0 */ 52 | memcpy(block + 8, &nlen, sizeof(nlen)); 53 | memcpy(block + 16, &flags, sizeof(flags)); 54 | /* reserved = 0 */ 55 | 56 | /* send an attention */ 57 | return dsi_stream_write(dsi, block, DSI_BLOCKSIZ + len, DSI_NOWAIT); 58 | } 59 | -------------------------------------------------------------------------------- /libatalk/dsi/dsi_close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 4 | * All rights reserved. See COPYRIGHT. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | void dsi_close(DSI *dsi) 18 | { 19 | /* server generated. need to set all the fields. */ 20 | if (!(dsi->flags & DSI_SLEEPING) && !(dsi->flags & DSI_DISCONNECTED)) { 21 | dsi->header.dsi_flags = DSIFL_REQUEST; 22 | dsi->header.dsi_command = DSIFUNC_CLOSE; 23 | dsi->header.dsi_requestID = htons(dsi_serverID(dsi)); 24 | dsi->header.dsi_data.dsi_code = dsi->header.dsi_reserved = htonl(0); 25 | dsi->cmdlen = 0; 26 | dsi_send(dsi); 27 | dsi->proto_close(dsi); 28 | } 29 | free(dsi); 30 | } 31 | -------------------------------------------------------------------------------- /libatalk/dsi/dsi_cmdreply.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 3 | * All rights reserved. See COPYRIGHT. 4 | */ 5 | 6 | #ifdef HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif /* HAVE_CONFIG_H */ 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | /* this assumes that the reply follows right after the command, saving 17 | * on a couple assignments. specifically, command, requestID, and 18 | * reserved field are assumed to already be set. */ 19 | int dsi_cmdreply(DSI *dsi, const int err) 20 | { 21 | int ret; 22 | 23 | LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %zd): START", 24 | dsi->clientID, dsi->datalen); 25 | 26 | dsi->header.dsi_flags = DSIFL_REPLY; 27 | dsi->header.dsi_len = htonl(dsi->datalen); 28 | dsi->header.dsi_data.dsi_code = htonl(err); 29 | 30 | ret = dsi_stream_send(dsi, dsi->data, dsi->datalen); 31 | 32 | LOG(log_debug, logtype_dsi, "dsi_cmdreply(DSI ID: %u, len: %zd): END", 33 | dsi->clientID, dsi->datalen); 34 | 35 | return ret; 36 | } 37 | -------------------------------------------------------------------------------- /libatalk/dsi/dsi_getstat.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 4 | * All rights reserved. See COPYRIGHT. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | /* return the status and then delete the connection. most of the 18 | * fields are already set. */ 19 | void dsi_getstatus(DSI *dsi) 20 | { 21 | dsi->header.dsi_flags = DSIFL_REPLY; 22 | /*dsi->header.dsi_command = DSIFUNC_STAT;*/ 23 | dsi->header.dsi_data.dsi_code = dsi->header.dsi_reserved = 0; 24 | 25 | memcpy(dsi->commands, dsi->status, dsi->statuslen); 26 | dsi->cmdlen = dsi->statuslen; 27 | dsi_send(dsi); 28 | } 29 | -------------------------------------------------------------------------------- /libatalk/dsi/dsi_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, Frank Lahm 3 | * All rights reserved. See COPYRIGHT. 4 | */ 5 | 6 | #ifdef HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif /* HAVE_CONFIG_H */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | DSI *dsi_init(AFPObj *obj, const char *hostname, const char *address, const char *port) 16 | { 17 | DSI *dsi; 18 | 19 | if ((dsi = (DSI *)calloc(1, sizeof(DSI))) == NULL) 20 | return NULL; 21 | 22 | dsi->attn_quantum = DSI_DEFQUANT; 23 | dsi->server_quantum = obj->options.server_quantum; 24 | dsi->dsireadbuf = obj->options.dsireadbuf; 25 | 26 | /* currently the only transport protocol that exists for dsi */ 27 | if (dsi_tcp_init(dsi, hostname, address, port) != 0) { 28 | free(dsi); 29 | dsi = NULL; 30 | } 31 | 32 | return dsi; 33 | } 34 | -------------------------------------------------------------------------------- /libatalk/dsi/dsi_read.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 3 | * All rights reserved. See COPYRIGHT. 4 | */ 5 | 6 | #ifdef HAVE_CONFIG_H 7 | #include "config.h" 8 | #endif /* HAVE_CONFIG_H */ 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /* streaming i/o for afp_read. this is all from the perspective of the 22 | * client. it basically does the reverse of dsi_write. on first entry, 23 | * it will send off the header plus whatever is in its command 24 | * buffer. it returns the amount of stuff still to be read 25 | * (constrained by the buffer size). */ 26 | ssize_t dsi_readinit(DSI *dsi, void *buf, const size_t buflen, const size_t size, const int err) 27 | { 28 | LOG(log_maxdebug, logtype_dsi, "dsi_readinit: sending %zd bytes from buffer, total size: %zd", 29 | buflen, size); 30 | 31 | dsi->flags |= DSI_NOREPLY; /* we will handle our own replies */ 32 | dsi->header.dsi_flags = DSIFL_REPLY; 33 | dsi->header.dsi_len = htonl(size); 34 | dsi->header.dsi_data.dsi_code = htonl(err); 35 | 36 | dsi->in_write++; 37 | if (dsi_stream_send(dsi, buf, buflen)) { 38 | dsi->datasize = size - buflen; 39 | LOG(log_maxdebug, logtype_dsi, "dsi_readinit: remaining data for sendfile: %zd", dsi->datasize); 40 | return MIN(dsi->datasize, buflen); 41 | } 42 | 43 | return -1; /* error */ 44 | } 45 | 46 | void dsi_readdone(DSI *dsi) 47 | { 48 | dsi->in_write--; 49 | } 50 | 51 | /* send off the data */ 52 | ssize_t dsi_read(DSI *dsi, void *buf, const size_t buflen) 53 | { 54 | size_t len; 55 | 56 | len = dsi_stream_write(dsi, buf, buflen, 0); 57 | 58 | if (len == buflen) { 59 | dsi->datasize -= len; 60 | return MIN(dsi->datasize, buflen); 61 | } 62 | 63 | return -1; 64 | } 65 | -------------------------------------------------------------------------------- /libatalk/dsi/dsi_tickle.c: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) 4 | * All rights reserved. See COPYRIGHT. 5 | */ 6 | 7 | #ifdef HAVE_CONFIG_H 8 | #include "config.h" 9 | #endif /* HAVE_CONFIG_H */ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | /* server generated tickles. as this is only called by the tickle handler, 19 | * we don't need to block signals. */ 20 | int dsi_tickle(DSI *dsi) 21 | { 22 | char block[DSI_BLOCKSIZ]; 23 | uint16_t id; 24 | 25 | if ((dsi->flags & DSI_SLEEPING) || dsi->in_write) 26 | return 1; 27 | 28 | id = htons(dsi_serverID(dsi)); 29 | 30 | memset(block, 0, sizeof(block)); 31 | block[0] = DSIFL_REQUEST; 32 | block[1] = DSIFUNC_TICKLE; 33 | memcpy(block + 2, &id, sizeof(id)); 34 | /* code = len = reserved = 0 */ 35 | 36 | return dsi_stream_write(dsi, block, DSI_BLOCKSIZ, DSI_NOWAIT); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /libatalk/dummy.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adiknoth/netatalk-debian/8b7dfba43213c5b134c5233f6a4d56114fa60917/libatalk/dummy.c -------------------------------------------------------------------------------- /libatalk/iniparser/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/iniparser/ 2 | 3 | noinst_LTLIBRARIES = libiniparser.la 4 | 5 | libiniparser_la_SOURCES = \ 6 | dictionary.c \ 7 | iniparser.c 8 | -------------------------------------------------------------------------------- /libatalk/talloc/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/talloc/ 2 | 3 | noinst_LTLIBRARIES = libtalloc.la 4 | libtalloc_la_SOURCES = talloc.c dalloc.c 5 | -------------------------------------------------------------------------------- /libatalk/tdb/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/tdb/ 2 | 3 | noinst_LTLIBRARIES = libtdb.la 4 | noinst_HEADERS = tdb_private.h 5 | libtdb_la_SOURCES = check.c \ 6 | dump.c \ 7 | error.c \ 8 | freelist.c \ 9 | freelistcheck.c \ 10 | io.c \ 11 | lock.c \ 12 | open.c \ 13 | tdb.c \ 14 | transaction.c \ 15 | traverse.c 16 | 17 | -------------------------------------------------------------------------------- /libatalk/tdb/error.c: -------------------------------------------------------------------------------- 1 | /* 2 | Unix SMB/CIFS implementation. 3 | 4 | trivial database library 5 | 6 | Copyright (C) Andrew Tridgell 1999-2005 7 | Copyright (C) Paul `Rusty' Russell 2000 8 | Copyright (C) Jeremy Allison 2000-2003 9 | 10 | ** NOTE! The following LGPL license applies to the tdb 11 | ** library. This does NOT imply that all of Samba is released 12 | ** under the LGPL 13 | 14 | This library is free software; you can redistribute it and/or 15 | modify it under the terms of the GNU Lesser General Public 16 | License as published by the Free Software Foundation; either 17 | version 3 of the License, or (at your option) any later version. 18 | 19 | This library is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 | Lesser General Public License for more details. 23 | 24 | You should have received a copy of the GNU Lesser General Public 25 | License along with this library; if not, see . 26 | */ 27 | 28 | #include "tdb_private.h" 29 | 30 | enum TDB_ERROR tdb_error(struct tdb_context *tdb) 31 | { 32 | return tdb->ecode; 33 | } 34 | 35 | static struct tdb_errname { 36 | enum TDB_ERROR ecode; const char *estring; 37 | } emap[] = { {TDB_SUCCESS, "Success"}, 38 | {TDB_ERR_CORRUPT, "Corrupt database"}, 39 | {TDB_ERR_IO, "IO Error"}, 40 | {TDB_ERR_LOCK, "Locking error"}, 41 | {TDB_ERR_OOM, "Out of memory"}, 42 | {TDB_ERR_EXISTS, "Record exists"}, 43 | {TDB_ERR_NOLOCK, "Lock exists on other keys"}, 44 | {TDB_ERR_EINVAL, "Invalid parameter"}, 45 | {TDB_ERR_NOEXIST, "Record does not exist"}, 46 | {TDB_ERR_RDONLY, "write not permitted"} }; 47 | 48 | /* Error string for the last tdb error */ 49 | const char *tdb_errorstr(struct tdb_context *tdb) 50 | { 51 | uint32_t i; 52 | for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++) 53 | if (tdb->ecode == emap[i].ecode) 54 | return emap[i].estring; 55 | return "Invalid error code"; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /libatalk/unicode/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/util/ 2 | 3 | noinst_LTLIBRARIES = libunicode.la 4 | 5 | AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/sys @ICONV_CFLAGS@ 6 | 7 | SUBDIRS = charsets 8 | 9 | LIBUNICODE_DEPS = charsets/libcharsets.la 10 | 11 | libunicode_la_SOURCES = \ 12 | util_unistr.c \ 13 | iconv.c \ 14 | charcnv.c \ 15 | utf8.c \ 16 | utf16_case.c 17 | 18 | libunicode_la_LIBADD = $(LIBUNICODE_DEPS) 19 | 20 | noinst_HEADERS = utf16_casetable.h precompose.h 21 | 22 | LIBS=@ICONV_LIBS@ 23 | -------------------------------------------------------------------------------- /libatalk/unicode/charsets/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/unicode/charsets 2 | 3 | noinst_LTLIBRARIES = libcharsets.la 4 | 5 | AM_CFLAGS = -I$(top_srcdir)/sys @CFLAGS@ @ICONV_CFLAGS@ 6 | LIBS = 7 | 8 | libcharsets_la_SOURCES = \ 9 | mac_roman.c \ 10 | mac_greek.c \ 11 | mac_hebrew.c \ 12 | mac_centraleurope.c \ 13 | mac_turkish.c \ 14 | mac_cyrillic.c \ 15 | mac_japanese.c \ 16 | mac_chinese_trad.c \ 17 | mac_chinese_simp.c \ 18 | mac_korean.c \ 19 | generic_cjk.c \ 20 | generic_mb.c 21 | 22 | noinst_HEADERS = \ 23 | mac_roman.h \ 24 | mac_greek.h \ 25 | mac_centraleurope.h \ 26 | mac_hebrew.h \ 27 | mac_turkish.h \ 28 | mac_cyrillic.h \ 29 | mac_japanese.h \ 30 | mac_chinese_trad.h \ 31 | mac_chinese_simp.h \ 32 | mac_korean.h \ 33 | generic_cjk.h \ 34 | generic_mb.h 35 | -------------------------------------------------------------------------------- /libatalk/unicode/charsets/generic_cjk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * generic_cjk 3 | * Copyright (C) TSUBAKIMOTO Hiroya 2004 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #define CJK_PUSH_BUFFER 4 25 | #define CJK_PULL_BUFFER 8 26 | 27 | typedef struct { 28 | uint16_t range[2]; 29 | const uint16_t (*summary)[2]; 30 | } cjk_index_t; 31 | 32 | extern size_t cjk_generic_push (size_t (*)(uint8_t*, const ucs2_t*, size_t*), 33 | void*, char**, size_t*, char**, size_t*); 34 | extern size_t cjk_generic_pull (size_t (*)(ucs2_t*, const uint8_t*, size_t*), 35 | void*, char**, size_t*, char**, size_t*); 36 | 37 | extern size_t cjk_char_push (uint16_t, uint8_t*); 38 | extern size_t cjk_char_pull (ucs2_t, ucs2_t*, const uint32_t*); 39 | 40 | extern uint16_t cjk_lookup (uint16_t, const cjk_index_t*, const uint16_t*); 41 | extern ucs2_t cjk_compose (ucs2_t, ucs2_t, const uint32_t*, size_t); 42 | extern ucs2_t cjk_compose_seq (const ucs2_t*, size_t*, const uint32_t*, size_t); 43 | -------------------------------------------------------------------------------- /libatalk/unicode/charsets/generic_mb.h: -------------------------------------------------------------------------------- 1 | size_t mb_generic_pull(int (*charfunc)(ucs2_t *, const unsigned char *), void *,char **, size_t *, char **, size_t *); 2 | size_t mb_generic_push(int (*charfunc)(unsigned char *, ucs2_t), void *,char **, size_t *, char **, size_t *); 3 | -------------------------------------------------------------------------------- /libatalk/util/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/util/ 2 | 3 | pkgconfdir = @PKGCONFDIR@ 4 | 5 | noinst_LTLIBRARIES = libutil.la 6 | 7 | libutil_la_SOURCES = \ 8 | bprint.c \ 9 | cnid.c \ 10 | fault.c \ 11 | getiface.c \ 12 | gettok.c \ 13 | locking.c \ 14 | logger.c \ 15 | module.c \ 16 | netatalk_conf.c \ 17 | queue.c \ 18 | server_child.c \ 19 | server_ipc.c \ 20 | server_lock.c \ 21 | socket.c \ 22 | strdicasecmp.c \ 23 | unix.c 24 | 25 | libutil_la_CFLAGS = \ 26 | -D_PATH_CONFDIR='"$(pkgconfdir)/"' \ 27 | -DSERVERTEXT='"$(SERVERTEXT)/"' \ 28 | -D_PATH_AFPDPWFILE='"$(pkgconfdir)/afppasswd"' \ 29 | -D_PATH_AFPDUAMPATH='"$(UAMS_PATH)/"' \ 30 | -D_PATH_STATEDIR='"$(localstatedir)/netatalk/"' 31 | 32 | if HAVE_ATFUNCS 33 | libutil_la_SOURCES += ftw.c 34 | endif 35 | -------------------------------------------------------------------------------- /libatalk/util/bprint.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | #include "config.h" 3 | #endif 4 | 5 | #ifdef DEBUG 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | static const char hexdig[] = "0123456789ABCDEF"; 14 | 15 | #define BPXLEN 50 16 | #define BPALEN 18 17 | 18 | void bprint( data, len ) 19 | char *data; 20 | int len; 21 | { 22 | char xout[ BPXLEN ], aout[ BPALEN ]; 23 | int i; 24 | 25 | memset( xout, 0, BPXLEN ); 26 | memset( aout, 0, BPALEN ); 27 | 28 | for ( i = 0; len; len--, data++, i++ ) { 29 | if ( i == 16 ) { 30 | printf( "%-48s\t%-16s\n", xout, aout ); 31 | memset( xout, 0, BPXLEN ); 32 | memset( aout, 0, BPALEN ); 33 | i = 0; 34 | } 35 | 36 | if (isprint( (unsigned char)*data )) { 37 | aout[ i ] = *data; 38 | } else { 39 | aout[ i ] = '.'; 40 | } 41 | 42 | xout[ (i*3) ] = hexdig[ ( *data & 0xf0 ) >> 4 ]; 43 | xout[ (i*3) + 1 ] = hexdig[ *data & 0x0f ]; 44 | xout[ (i*3) + 2 ] = ' '; 45 | } 46 | 47 | if ( i ) 48 | printf( "%-48s\t%-16s\n", xout, aout ); 49 | 50 | printf("(end)\n"); 51 | } 52 | #endif 53 | -------------------------------------------------------------------------------- /libatalk/util/module.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "config.h" 6 | #endif /* HAVE_CONFIG_H */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #ifndef HAVE_DLFCN_H 13 | #ifdef MACOSX_SERVER 14 | #include 15 | 16 | void *mod_open(const char *path) 17 | { 18 | NSObjectFileImage file; 19 | 20 | if (NSCreateObjectFileImageFromFile(path, &file) != 21 | NSObjectFileImageSuccess) 22 | return NULL; 23 | return NSLinkModule(file, path, TRUE); 24 | } 25 | 26 | void *mod_symbol(void *module, const char *name) 27 | { 28 | NSSymbol symbol; 29 | char *underscore; 30 | 31 | if ((underscore = (char *) malloc(strlen(name) + 2)) == NULL) 32 | return NULL; 33 | strcpy(underscore, "_"); 34 | strcat(underscore, name); 35 | symbol = NSLookupAndBindSymbol(underscore); 36 | free(underscore); 37 | 38 | return NSAddressOfSymbol(symbol); 39 | } 40 | 41 | void mod_close(void *module) 42 | { 43 | NSUnLinkModule(module, FALSE); 44 | } 45 | #endif /* MACOSX_SERVER */ 46 | 47 | #else /* HAVE_DLFCN_H */ 48 | 49 | #include 50 | 51 | #ifdef DLSYM_PREPEND_UNDERSCORE 52 | void *mod_symbol(void *module, const char *name) 53 | { 54 | void *symbol; 55 | char *underscore; 56 | 57 | if (!module) 58 | return NULL; 59 | 60 | if ((underscore = (char *) malloc(strlen(name) + 2)) == NULL) 61 | return NULL; 62 | 63 | strcpy(underscore, "_"); 64 | strcat(underscore, name); 65 | symbol = dlsym(module, underscore); 66 | free(underscore); 67 | 68 | return symbol; 69 | } 70 | #endif /* DLSYM_PREPEND_UNDERSCORE */ 71 | #endif /* HAVE_DLFCN_H */ 72 | -------------------------------------------------------------------------------- /libatalk/vfs/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for libatalk/vfs/ 2 | 3 | noinst_LTLIBRARIES = libvfs.la 4 | 5 | libvfs_la_SOURCES = vfs.c unix.c ea_ad.c ea_sys.c extattr.c 6 | 7 | if HAVE_ACLS 8 | libvfs_la_SOURCES += acl.c 9 | endif 10 | -------------------------------------------------------------------------------- /libevent/Makefile.nmake: -------------------------------------------------------------------------------- 1 | # WATCH OUT! This makefile is a work in progress. It is probably missing 2 | # tons of important things. DO NOT RELY ON IT TO BUILD A GOOD LIBEVENT. 3 | 4 | # Needed for correctness 5 | CFLAGS=/IWIN32-Code /Iinclude /Icompat /DWIN32 /DHAVE_CONFIG_H /I. 6 | 7 | # For optimization and warnings 8 | CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo 9 | 10 | # XXXX have a debug mode 11 | 12 | LIBFLAGS=/nologo 13 | 14 | CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \ 15 | bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \ 16 | strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \ 17 | bufferevent_ratelim.obj evutil_rand.obj 18 | WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \ 19 | event_iocp.obj bufferevent_async.obj 20 | EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj 21 | 22 | ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) 23 | STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib 24 | 25 | 26 | all: static_libs tests 27 | 28 | static_libs: $(STATIC_LIBS) 29 | 30 | libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS) 31 | lib $(LIBFLAGS) $(CORE_OBJS) $(WIN_OBJS) /out:libevent_core.lib 32 | 33 | libevent_extras.lib: $(EXTRA_OBJS) 34 | lib $(LIBFLAGS) $(EXTRA_OBJS) /out:libevent_extras.lib 35 | 36 | libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) 37 | lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib 38 | 39 | clean: 40 | del $(ALL_OBJS) 41 | del $(STATIC_LIBS) 42 | cd test 43 | $(MAKE) /F Makefile.nmake clean 44 | 45 | tests: 46 | cd test 47 | $(MAKE) /F Makefile.nmake 48 | -------------------------------------------------------------------------------- /libevent/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -x "`which autoreconf 2>/dev/null`" ] ; then 3 | exec autoreconf -ivf 4 | fi 5 | 6 | LIBTOOLIZE=libtoolize 7 | SYSNAME=`uname` 8 | if [ "x$SYSNAME" = "xDarwin" ] ; then 9 | LIBTOOLIZE=glibtoolize 10 | fi 11 | aclocal -I m4 && \ 12 | autoheader && \ 13 | $LIBTOOLIZE && \ 14 | autoconf && \ 15 | automake --add-missing --force-missing --copy 16 | -------------------------------------------------------------------------------- /libevent/evdns.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVDNS_H_ 28 | #define _EVDNS_H_ 29 | 30 | /** @file evdns.h 31 | 32 | A dns subsystem for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVDNS_H_ */ 46 | -------------------------------------------------------------------------------- /libevent/evhttp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2000-2007 Niels Provos 3 | * Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVHTTP_H_ 28 | #define _EVHTTP_H_ 29 | 30 | /** @file evhttp.h 31 | 32 | An http implementation subsystem for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVHTTP_H_ */ 46 | -------------------------------------------------------------------------------- /libevent/evrpc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Niels Provos 3 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef _EVRPC_H_ 28 | #define _EVRPC_H_ 29 | 30 | /** @file evrpc.h 31 | 32 | An RPC system for Libevent. 33 | 34 | The header is deprecated in Libevent 2.0 and later; please 35 | use instead. Depending on what functionality you 36 | need, you may also want to include more of the other 37 | headers. 38 | */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* _EVRPC_H_ */ 46 | -------------------------------------------------------------------------------- /libevent/evutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. The name of the author may not be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | #ifndef _EVUTIL_H_ 27 | #define _EVUTIL_H_ 28 | 29 | /** @file evutil.h 30 | 31 | Utility and compatibility functions for Libevent. 32 | 33 | The header is deprecated in Libevent 2.0 and later; please 34 | use instead. 35 | */ 36 | 37 | #include 38 | 39 | #endif /* _EVUTIL_H_ */ 40 | -------------------------------------------------------------------------------- /libevent/include/Makefile.am: -------------------------------------------------------------------------------- 1 | # include/Makefile.am for libevent 2 | # Copyright 2000-2007 Niels Provos 3 | # Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | # 5 | # See LICENSE for copying information. 6 | 7 | AUTOMAKE_OPTIONS = foreign 8 | 9 | EVENT2_EXPORT = \ 10 | event2/buffer.h \ 11 | event2/buffer_compat.h \ 12 | event2/bufferevent.h \ 13 | event2/bufferevent_compat.h \ 14 | event2/bufferevent_ssl.h \ 15 | event2/bufferevent_struct.h \ 16 | event2/dns.h \ 17 | event2/dns_compat.h \ 18 | event2/dns_struct.h \ 19 | event2/event.h \ 20 | event2/event_compat.h \ 21 | event2/event_struct.h \ 22 | event2/http.h \ 23 | event2/http_compat.h \ 24 | event2/http_struct.h \ 25 | event2/keyvalq_struct.h \ 26 | event2/listener.h \ 27 | event2/rpc.h \ 28 | event2/rpc_compat.h \ 29 | event2/rpc_struct.h \ 30 | event2/tag.h \ 31 | event2/tag_compat.h \ 32 | event2/thread.h \ 33 | event2/util.h 34 | 35 | EXTRA_SRC = $(EVENT2_EXPORT) 36 | 37 | ## Without the nobase_ prefixing, Automake would strip "event2/" from 38 | ## the source header filename to derive the installed header filename. 39 | ## With nobase_ the installed path is $(includedir)/event2/ev*.h. 40 | 41 | if INSTALL_LIBEVENT 42 | nobase_include_HEADERS = $(EVENT2_EXPORT) 43 | nobase_nodist_include_HEADERS = ./event2/event-config.h 44 | else 45 | noinst_HEADERS = $(EVENT2_EXPORT) 46 | nodist_noinst_HEADERS = ./event2/event-config.h 47 | endif 48 | -------------------------------------------------------------------------------- /libevent/libevent.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent 9 | Description: libevent is an asynchronous notification event loop library 10 | Version: @VERSION@ 11 | Requires: 12 | Conflicts: 13 | Libs: -L${libdir} -levent 14 | Libs.private: @LIBS@ 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /libevent/libevent_openssl.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent_openssl 9 | Description: libevent_openssl adds openssl-based TLS support to libevent 10 | Version: @VERSION@ 11 | Requires: libevent 12 | Conflicts: 13 | Libs: -L${libdir} -levent_openssl 14 | Libs.private: @LIBS@ -lssl -lcrypto 15 | Cflags: -I${includedir} 16 | 17 | -------------------------------------------------------------------------------- /libevent/libevent_pthreads.pc.in: -------------------------------------------------------------------------------- 1 | #libevent pkg-config source file 2 | 3 | prefix=@prefix@ 4 | exec_prefix=@exec_prefix@ 5 | libdir=@libdir@ 6 | includedir=@includedir@ 7 | 8 | Name: libevent_pthreads 9 | Description: libevent_pthreads adds pthreads-based threading support to libevent 10 | Version: @VERSION@ 11 | Requires: libevent 12 | Conflicts: 13 | Libs: -L${libdir} -levent_pthreads 14 | Libs.private: @LIBS@ @PTHREAD_LIBS@ 15 | Cflags: -I${includedir} @PTHREAD_CFLAGS@ 16 | 17 | -------------------------------------------------------------------------------- /libevent/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 4179 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.6]) 16 | m4_define([LT_PACKAGE_REVISION], [2.4.6]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.6' 20 | macro_revision='2.4.6' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /libevent/sample/Makefile.am: -------------------------------------------------------------------------------- 1 | # sample/Makefile.am for libevent 2 | # Copyright 2000-2007 Niels Provos 3 | # Copyright 2007-2012 Niels Provos and Nick Mathewson 4 | # 5 | # See LICENSE for copying information. 6 | 7 | AUTOMAKE_OPTIONS = foreign no-dependencies 8 | 9 | LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la 10 | AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include 11 | 12 | noinst_PROGRAMS = event-test time-test signal-test dns-example hello-world http-server 13 | 14 | event_test_SOURCES = event-test.c 15 | time_test_SOURCES = time-test.c 16 | signal_test_SOURCES = signal-test.c 17 | dns_example_SOURCES = dns-example.c 18 | hello_world_SOURCES = hello-world.c 19 | http_server_SOURCES = http-server.c 20 | 21 | if OPENSSL 22 | noinst_PROGRAMS += le-proxy 23 | le_proxy_SOURCES = le-proxy.c 24 | le_proxy_LDADD = $(LDADD) ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD} 25 | endif 26 | 27 | verify: 28 | 29 | DISTCLEANFILES = *~ 30 | -------------------------------------------------------------------------------- /libevent/sample/signal-test.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Compile with: 3 | * cc -I/usr/local/include -o signal-test \ 4 | * signal-test.c -L/usr/local/lib -levent 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | 11 | #include 12 | #ifndef WIN32 13 | #include 14 | #include 15 | #include 16 | #else 17 | #include 18 | #include 19 | #endif 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #ifdef _EVENT___func__ 30 | #define __func__ _EVENT___func__ 31 | #endif 32 | 33 | int called = 0; 34 | 35 | static void 36 | signal_cb(evutil_socket_t fd, short event, void *arg) 37 | { 38 | struct event *signal = arg; 39 | 40 | printf("%s: got signal %d\n", __func__, EVENT_SIGNAL(signal)); 41 | 42 | if (called >= 2) 43 | event_del(signal); 44 | 45 | called++; 46 | } 47 | 48 | int 49 | main(int argc, char **argv) 50 | { 51 | struct event signal_int; 52 | struct event_base* base; 53 | #ifdef WIN32 54 | WORD wVersionRequested; 55 | WSADATA wsaData; 56 | int err; 57 | 58 | wVersionRequested = MAKEWORD(2, 2); 59 | 60 | err = WSAStartup(wVersionRequested, &wsaData); 61 | #endif 62 | 63 | /* Initalize the event library */ 64 | base = event_base_new(); 65 | 66 | /* Initalize one event */ 67 | event_assign(&signal_int, base, SIGINT, EV_SIGNAL|EV_PERSIST, signal_cb, 68 | &signal_int); 69 | 70 | event_add(&signal_int, NULL); 71 | 72 | event_base_dispatch(base); 73 | event_base_free(base); 74 | 75 | return (0); 76 | } 77 | 78 | -------------------------------------------------------------------------------- /libevent/strlcpy-internal.h: -------------------------------------------------------------------------------- 1 | #ifndef _STRLCPY_INTERNAL_H_ 2 | #define _STRLCPY_INTERNAL_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "event2/event-config.h" 9 | 10 | #ifndef _EVENT_HAVE_STRLCPY 11 | #include 12 | size_t _event_strlcpy(char *dst, const char *src, size_t siz); 13 | #define strlcpy _event_strlcpy 14 | #endif 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /libevent/test/Makefile.nmake: -------------------------------------------------------------------------------- 1 | 2 | CFLAGS=/I.. /I../WIN32-Code /I../include /I../compat /DWIN32 /DHAVE_CONFIG_H /DTINYTEST_LOCAL 3 | 4 | CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /nologo 5 | 6 | REGRESS_OBJS=regress.obj regress_buffer.obj regress_http.obj regress_dns.obj \ 7 | regress_testutils.obj \ 8 | regress_rpc.obj regress.gen.obj \ 9 | regress_et.obj regress_bufferevent.obj \ 10 | regress_listener.obj regress_util.obj tinytest.obj \ 11 | regress_main.obj regress_minheap.obj regress_iocp.obj \ 12 | regress_thread.obj 13 | 14 | OTHER_OBJS=test-init.obj test-eof.obj test-weof.obj test-time.obj \ 15 | bench.obj bench_cascade.obj bench_http.obj bench_httpclient.obj \ 16 | test-changelist.obj 17 | 18 | PROGRAMS=regress.exe \ 19 | test-init.exe test-eof.exe test-weof.exe test-time.exe \ 20 | test-changelist.exe 21 | 22 | # Disabled for now: 23 | # bench.exe bench_cascade.exe bench_http.exe bench_httpclient.exe 24 | 25 | 26 | LIBS=..\libevent.lib ws2_32.lib shell32.lib advapi32.lib 27 | 28 | all: $(PROGRAMS) 29 | 30 | regress.exe: $(REGRESS_OBJS) 31 | $(CC) $(CFLAGS) $(LIBS) $(REGRESS_OBJS) 32 | 33 | test-init.exe: test-init.obj 34 | $(CC) $(CFLAGS) $(LIBS) test-init.obj 35 | test-eof.exe: test-eof.obj 36 | $(CC) $(CFLAGS) $(LIBS) test-eof.obj 37 | test-changelist.exe: test-changelist.obj 38 | $(CC) $(CFLAGS) $(LIBS) test-changelist.obj 39 | test-weof.exe: test-weof.obj 40 | $(CC) $(CFLAGS) $(LIBS) test-weof.obj 41 | test-time.exe: test-time.obj 42 | $(CC) $(CFLAGS) $(LIBS) test-time.obj 43 | 44 | bench.exe: bench.obj 45 | $(CC) $(CFLAGS) $(LIBS) bench.obj 46 | bench_cascade.exe: bench_cascade.obj 47 | $(CC) $(CFLAGS) $(LIBS) bench_cascade.obj 48 | bench_http.exe: bench_http.obj 49 | $(CC) $(CFLAGS) $(LIBS) bench_http.obj 50 | bench_httpclient.exe: bench_httpclient.obj 51 | $(CC) $(CFLAGS) $(LIBS) bench_httpclient.obj 52 | 53 | regress.gen.c regress.gen.h: regress.rpc ../event_rpcgen.py 54 | echo // > regress.gen.c 55 | echo #define NO_PYTHON_EXISTS > regress.gen.h 56 | -python ..\event_rpcgen.py regress.rpc 57 | 58 | clean: 59 | -del $(REGRESS_OBJS) 60 | -del $(OTHER_OBJS) 61 | -del regress.exe 62 | -------------------------------------------------------------------------------- /libevent/test/regress.rpc: -------------------------------------------------------------------------------- 1 | /* tests data packing and unpacking */ 2 | 3 | struct msg { 4 | string /* sender */ from_name = 1; /* be verbose */ 5 | string to_name = 2; 6 | optional struct[kill] attack = 3; 7 | array struct[run] run = 4; 8 | } 9 | 10 | struct kill { 11 | string weapon = 0x10121; 12 | string action = 2; 13 | array int how_often = 3; 14 | } 15 | 16 | struct run { 17 | string how = 1; 18 | optional bytes some_bytes = 2; 19 | 20 | bytes fixed_bytes[24] = 3; 21 | array string notes = 4; 22 | 23 | optional int64 large_number = 5; 24 | array int other_numbers = 6; 25 | } 26 | -------------------------------------------------------------------------------- /libevent/test/rpcgen_wrapper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # libevent rpcgen_wrapper.sh 3 | # Transforms event_rpcgen.py failure into success for make, only if 4 | # regress.gen.c and regress.gen.h already exist in $srcdir. This 5 | # is needed for "make distcheck" to pass the read-only $srcdir build, 6 | # as with read-only sources fresh from tarball, regress.gen.[ch] will 7 | # be correct in $srcdir but unwritable. This previously triggered 8 | # Makefile.am to create stub regress.gen.c and regress.gen.h in the 9 | # distcheck _build directory, which were then detected as leftover 10 | # files in the build tree after distclean, breaking distcheck. 11 | # Note that regress.gen.[ch] are not in fresh git clones, making 12 | # working Python a requirement for make distcheck of a git tree. 13 | 14 | exit_updated() { 15 | echo "Updated ${srcdir}\regress.gen.c and ${srcdir}\regress.gen.h" 16 | exit 0 17 | } 18 | 19 | exit_reuse() { 20 | echo "event_rpcgen.py failed, ${srcdir}\regress.gen.\[ch\] will be reused." >&2 21 | exit 0 22 | } 23 | 24 | exit_failed() { 25 | echo "Could not generate regress.gen.\[ch\] using event_rpcgen.sh" >&2 26 | exit 1 27 | } 28 | 29 | srcdir=$1 30 | srcdir=${srcdir:-.} 31 | ${srcdir}/../event_rpcgen.py ${srcdir}/regress.rpc 32 | case "$?" in 33 | 0) 34 | exit_updated 35 | ;; 36 | *) 37 | test -r ${srcdir}/regress.gen.c -a -r ${srcdir}/regress.gen.h && \ 38 | exit_reuse 39 | exit_failed 40 | ;; 41 | esac 42 | -------------------------------------------------------------------------------- /libevent/test/tinytest_local.h: -------------------------------------------------------------------------------- 1 | 2 | #ifdef WIN32 3 | #include 4 | #endif 5 | 6 | #include "event2/util.h" 7 | #include "util-internal.h" 8 | 9 | #ifdef snprintf 10 | #undef snprintf 11 | #endif 12 | #define snprintf evutil_snprintf 13 | -------------------------------------------------------------------------------- /macros/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = \ 2 | afs-check.m4 \ 3 | ax_pthread.m4 \ 4 | cnid-backend.m4 \ 5 | config-checks.m4 \ 6 | db3-check.m4 \ 7 | grep-check.m4 \ 8 | gssapi-check.m4 \ 9 | iconv.m4 \ 10 | largefile-check.m4 \ 11 | libgcrypt.m4 \ 12 | netatalk.m4 \ 13 | pam-check.m4 \ 14 | perl-check.m4 \ 15 | ps-check.m4 \ 16 | quota-check.m4 \ 17 | ssl-check.m4 \ 18 | summary.m4 \ 19 | tcp-wrappers.m4 \ 20 | util.m4 21 | -------------------------------------------------------------------------------- /macros/afs-check.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macro to check whether AFS support should be enabled 2 | 3 | AC_DEFUN([AC_NETATALK_AFS_CHECK], [ 4 | AFS_LIBS= 5 | AFS_CFLAGS= 6 | 7 | netatalk_cv_afs=no 8 | AC_ARG_ENABLE(afs, 9 | [ --enable-afs enable AFS support], 10 | [ 11 | if test "x$enableval" = "xyes"; then 12 | AC_CHECK_LIB(afsauthent, pioctl, netatalk_cv_afs=yes, 13 | AC_MSG_ERROR([AFS installation not found]) 14 | ) 15 | AFS_LIBS=-lresolv -lafsrpc -lafsauthent 16 | AC_DEFINE(AFS, 1, [Define if AFS should be used]) 17 | fi 18 | ] 19 | ) 20 | 21 | AC_MSG_CHECKING([whether to enable AFS support]) 22 | if test x"$netatalk_cv_afs" = x"yes"; then 23 | AC_MSG_RESULT([yes]) 24 | else 25 | AC_MSG_RESULT([no]) 26 | fi 27 | 28 | AC_SUBST(AFS_LIBS) 29 | AC_SUBST(AFS_CFLAGS) 30 | ]) 31 | -------------------------------------------------------------------------------- /macros/config-checks.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macro to set the configuration directories. 2 | 3 | AC_DEFUN([AC_NETATALK_CONFIG_DIRS], [ 4 | PKGCONFDIR="${sysconfdir}" 5 | 6 | AC_ARG_WITH(pkgconfdir, 7 | [ --with-pkgconfdir=DIR package specific configuration in DIR 8 | [[$sysconfdir]]], 9 | [ 10 | if test "x$withval" != "x"; then 11 | PKGCONFDIR="$withval" 12 | fi 13 | ] 14 | ) 15 | 16 | 17 | SERVERTEXT="${localstatedir}/netatalk/msg" 18 | 19 | AC_ARG_WITH(message-dir, 20 | [ --with-message-dir=PATH path to server message files [[$localstatedir/netatalk/msg/]]], 21 | [ 22 | if test x"$withval" = x"no"; then 23 | AC_MSG_WARN([message-dir is mandatory and cannot be disabled, using default]) 24 | elif test "x$withval" != "x" && test x"$withval" != x"yes"; then 25 | SERVERTEXT="$withval" 26 | fi 27 | ] 28 | ) 29 | 30 | AC_SUBST(PKGCONFDIR) 31 | AC_SUBST(SERVERTEXT) 32 | ]) 33 | -------------------------------------------------------------------------------- /macros/grep-check.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macro to check for the existence of grep 2 | 3 | AC_DEFUN([AC_PROG_GREP], [ 4 | AC_REQUIRE([AC_EXEEXT])dnl 5 | test x$GREP = x && AC_PATH_PROG(GREP, grep$EXEEXT, grep$EXEEXT) 6 | test x$GREP = x && AC_MSG_ERROR([no acceptable grep found in \$PATH]) 7 | ]) 8 | 9 | AC_SUBST(GREP) 10 | -------------------------------------------------------------------------------- /macros/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 4179 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.6]) 16 | m4_define([LT_PACKAGE_REVISION], [2.4.6]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.6' 20 | macro_revision='2.4.6' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /macros/perl-check.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macro to check for the existence of Perl 2 | 3 | AC_DEFUN([AC_PROG_PERL], [ 4 | AC_REQUIRE([AC_EXEEXT])dnl 5 | test "x$PERL" = x && AC_PATH_PROG(PERL, perl$EXEEXT, perl$EXEEXT) 6 | test "x$PERL" = x && AC_MSG_ERROR([no acceptable Perl found in \$PATH]) 7 | ]) 8 | 9 | AC_SUBST(PERL) 10 | -------------------------------------------------------------------------------- /macros/ps-check.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macro to check for the existence of ps 2 | 3 | AC_DEFUN([AC_PROG_PS], [ 4 | AC_REQUIRE([AC_EXEEXT])dnl 5 | test x$PS = x && AC_PATH_PROG(PS, ps$EXEEXT, ps$EXEEXT) 6 | test x$PS = x && AC_MSG_ERROR([no acceptable ps found in \$PATH]) 7 | ]) 8 | 9 | AC_SUBST(PS) 10 | -------------------------------------------------------------------------------- /macros/quota-check.m4: -------------------------------------------------------------------------------- 1 | dnl Autoconf macro to check for quota support 2 | dnl FIXME: This is in now way complete. 3 | 4 | AC_DEFUN([AC_NETATALK_CHECK_QUOTA], [ 5 | AC_ARG_ENABLE(quota, 6 | [ --enable-quota Turn on quota support (default=auto)]) 7 | 8 | if test x$enable_quota != xno; then 9 | QUOTA_LIBS="" 10 | netatalk_cv_quotasupport="yes" 11 | AC_CHECK_LIB(rpcsvc, main, [QUOTA_LIBS="-lrpcsvc"]) 12 | AC_CHECK_HEADERS([rpc/rpc.h rpc/pmap_prot.h rpcsvc/rquota.h],[],[ 13 | QUOTA_LIBS="" 14 | netatalk_cv_quotasupport="no" 15 | AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if quota support should not compiled]) 16 | ]) 17 | AC_CHECK_LIB(quota, getfsquota, [QUOTA_LIBS="-lquota -lprop -lrpcsvc" 18 | AC_DEFINE(HAVE_LIBQUOTA, 1, [define if you have libquota])], [], [-lprop -lrpcsvc]) 19 | else 20 | netatalk_cv_quotasupport="no" 21 | AC_DEFINE(NO_QUOTA_SUPPORT, 1, [Define if quota support should not compiled]) 22 | fi 23 | 24 | AC_SUBST(QUOTA_LIBS) 25 | ]) 26 | 27 | -------------------------------------------------------------------------------- /macros/tcp-wrappers.m4: -------------------------------------------------------------------------------- 1 | 2 | AC_DEFUN([AC_NETATALK_TCP_WRAPPERS], [ 3 | check=maybe 4 | AC_ARG_ENABLE(tcp-wrappers, 5 | [ --disable-tcp-wrappers disable TCP wrappers support], 6 | [ 7 | if test "x$enableval" = "xno"; then 8 | wrapcheck=no 9 | else 10 | wrapcheck=yes 11 | fi 12 | ] 13 | ) 14 | 15 | enable=no 16 | netatalk_cv_tcpwrap=no 17 | if test "x$wrapcheck" != "xno"; then 18 | saved_LIBS=$LIBS 19 | W_LIBS="-lwrap" 20 | LIBS="$LIBS $W_LIBS" 21 | AC_TRY_LINK([ int allow_severity = 0; int deny_severity = 0;] 22 | ,[hosts_access();] 23 | , netatalk_cv_tcpwrap=yes , 24 | [ 25 | LIBS=$saved_LIBS 26 | W_LIBS="-lwrap -lnsl" 27 | LIBS="$LIBS $W_LIBS" 28 | AC_TRY_LINK([ int allow_severity = 0; int deny_severity = 0;] 29 | ,[hosts_access();] 30 | , netatalk_cv_tcpwrap=yes , netatalk_cv_tcpwrap=no) 31 | ] 32 | , netatalk_cv_tcpwrap=cross) 33 | 34 | LIBS=$saved_LIBS 35 | fi 36 | 37 | AC_MSG_CHECKING([whether to enable the TCP wrappers]) 38 | if test "x$netatalk_cv_tcpwrap" = "xyes"; then 39 | AC_DEFINE(TCPWRAP, 1, [Define if TCP wrappers should be used]) 40 | WRAP_LIBS=$W_LIBS 41 | AC_MSG_RESULT([yes]) 42 | else 43 | if test "x$wrapcheck" = "xyes"; then 44 | AC_MSG_ERROR([libwrap not found]) 45 | else 46 | AC_MSG_RESULT([no]) 47 | fi 48 | fi 49 | 50 | AC_SUBST(WRAP_LIBS) 51 | ]) 52 | -------------------------------------------------------------------------------- /macros/util.m4: -------------------------------------------------------------------------------- 1 | dnl Removes -I/usr/include/? from given variable 2 | AC_DEFUN([CFLAGS_REMOVE_USR_INCLUDE],[ 3 | ac_new_flags="" 4 | for i in [$]$1; do 5 | case [$]i in 6 | -I/usr/include|-I/usr/include/) ;; 7 | *) ac_new_flags="[$]ac_new_flags [$]i" ;; 8 | esac 9 | done 10 | $1=[$]ac_new_flags 11 | ]) 12 | 13 | dnl Removes -L/usr/lib/? from given variable 14 | AC_DEFUN([LIB_REMOVE_USR_LIB],[ 15 | ac_new_flags="" 16 | for i in [$]$1; do 17 | case [$]i in 18 | -L/usr/lib|-L/usr/lib/|-L/usr|-L/usr/) ;; 19 | *) ac_new_flags="[$]ac_new_flags [$]i" ;; 20 | esac 21 | done 22 | $1=[$]ac_new_flags 23 | ]) 24 | 25 | -------------------------------------------------------------------------------- /man/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for man/ 2 | 3 | SUBDIRS = man1 man5 man8 4 | -------------------------------------------------------------------------------- /man/man1/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for man/man1/ 2 | 3 | man_MANS = \ 4 | ad.1 \ 5 | afpldaptest.1 \ 6 | afppasswd.1 \ 7 | afpstats.1 \ 8 | apple_dump.1 \ 9 | asip-status.pl.1 \ 10 | dbd.1 \ 11 | macusers.1 \ 12 | netatalk-config.1 \ 13 | uniconv.1 14 | 15 | DISTCLEANFILES = $(man_MANS) 16 | -------------------------------------------------------------------------------- /man/man1/afpstats.1.in: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Title: afpstats 3 | .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] 4 | .\" Generator: DocBook XSL Stylesheets v1.78.0 5 | .\" Date: 24 Mar 2013 6 | .\" Manual: @NETATALK_VERSION@ 7 | .\" Source: @NETATALK_VERSION@ 8 | .\" Language: English 9 | .\" 10 | .TH "AFPSTATS" "1" "24 Mar 2013" "@NETATALK_VERSION@" "@NETATALK_VERSION@" 11 | .\" ----------------------------------------------------------------- 12 | .\" * Define some portability stuff 13 | .\" ----------------------------------------------------------------- 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | .\" http://bugs.debian.org/507673 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | .ie \n(.g .ds Aq \(aq 19 | .el .ds Aq ' 20 | .\" ----------------------------------------------------------------- 21 | .\" * set default formatting 22 | .\" ----------------------------------------------------------------- 23 | .\" disable hyphenation 24 | .nh 25 | .\" disable justification (adjust text to left margin only) 26 | .ad l 27 | .\" ----------------------------------------------------------------- 28 | .\" * MAIN CONTENT STARTS HERE * 29 | .\" ----------------------------------------------------------------- 30 | .SH "NAME" 31 | afpstats \- List AFP statistics 32 | .SH "SYNOPSIS" 33 | .HP \w'\fBafpstats\fR\ 'u 34 | \fBafpstats\fR 35 | .SH "DESCRIPTION" 36 | .PP 37 | \fBafpstats\fR 38 | list AFP statistics via D\-Bus IPC\&. 39 | .SH "NOTE" 40 | .PP 41 | \fBafpd\fR 42 | must support D\-Bus\&. Check it by "\fBafpd \-V\fR"\&. 43 | .PP 44 | "\fBafpstats = yes\fR" must be set in 45 | @pkgconfdir@/afp\&.conf\&. 46 | .SH "SEE ALSO" 47 | .PP 48 | \fBafpd\fR(8), 49 | \fBafp.conf\fR(5), 50 | \fBdbus-daemon\fR(1) 51 | -------------------------------------------------------------------------------- /man/man1/macusers.1.in: -------------------------------------------------------------------------------- 1 | '\" t 2 | .\" Title: macusers 3 | .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] 4 | .\" Generator: DocBook XSL Stylesheets v1.78.0 5 | .\" Date: 13 Oct 2011 6 | .\" Manual: @NETATALK_VERSION@ 7 | .\" Source: @NETATALK_VERSION@ 8 | .\" Language: English 9 | .\" 10 | .TH "MACUSERS" "1" "13 Oct 2011" "@NETATALK_VERSION@" "@NETATALK_VERSION@" 11 | .\" ----------------------------------------------------------------- 12 | .\" * Define some portability stuff 13 | .\" ----------------------------------------------------------------- 14 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | .\" http://bugs.debian.org/507673 16 | .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html 17 | .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 | .ie \n(.g .ds Aq \(aq 19 | .el .ds Aq ' 20 | .\" ----------------------------------------------------------------- 21 | .\" * set default formatting 22 | .\" ----------------------------------------------------------------- 23 | .\" disable hyphenation 24 | .nh 25 | .\" disable justification (adjust text to left margin only) 26 | .ad l 27 | .\" ----------------------------------------------------------------- 28 | .\" * MAIN CONTENT STARTS HERE * 29 | .\" ----------------------------------------------------------------- 30 | .SH "NAME" 31 | macusers \- List the users connecting via AFP 32 | .SH "SYNOPSIS" 33 | .HP \w'\fBmacusers\fR\ 'u 34 | \fBmacusers\fR 35 | .HP \w'\fBmacusers\fR\ 'u 36 | \fBmacusers\fR \-v | \-version | \-\-version | \-h | \-help | \-\-help 37 | .SH "DESCRIPTION" 38 | .PP 39 | \fBmacusers\fR 40 | list the users connecting via AFP\&. 41 | .SH "OPTIONS" 42 | .PP 43 | \fB\-v, \-version, \-\-version\fR 44 | .RS 4 45 | Show version and exit 46 | .RE 47 | .PP 48 | \fB\-h, \-help, \-\-help\fR 49 | .RS 4 50 | Display the help and exit 51 | .RE 52 | .SH "SEE ALSO" 53 | .PP 54 | \fBafpd\fR(8) 55 | -------------------------------------------------------------------------------- /man/man5/Makefile.am: -------------------------------------------------------------------------------- 1 | # Makefile.am for man/man5/ 2 | 3 | man_MANS = \ 4 | afp.conf.5 \ 5 | afp_signature.conf.5 \ 6 | afp_voluuid.conf.5 \ 7 | extmap.conf.5 8 | 9 | DISTCLEANFILES = $(man_MANS) 10 | -------------------------------------------------------------------------------- /man/man8/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Makefile.am for man/man8/ 2 | 3 | man_MANS = \ 4 | afpd.8 \ 5 | cnid_dbd.8 \ 6 | cnid_metad.8 \ 7 | netatalk.8 8 | 9 | DISTCLEANFILES = $(man_MANS) 10 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = afpd 2 | -------------------------------------------------------------------------------- /test/afpd/afpfunc_helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef AFPFUNC_HELPERS 16 | #define AFPFUNC_HELPERS 17 | 18 | #ifdef HAVE_CONFIG_H 19 | #include "config.h" 20 | #endif /* HAVE_CONFIG_H */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include "file.h" 37 | #include "filedir.h" 38 | #include "directory.h" 39 | #include "dircache.h" 40 | #include "hash.h" 41 | #include "afp_config.h" 42 | #include "volume.h" 43 | 44 | #include "test.h" 45 | #include "subtests.h" 46 | 47 | extern char **cnamewrap(const char *name); 48 | 49 | extern int getfiledirparms(AFPObj *obj, uint16_t vid, cnid_t did, const char *name); 50 | extern int createdir(AFPObj *obj, uint16_t vid, cnid_t did, const char *name); 51 | extern int createfile(AFPObj *obj, uint16_t vid, cnid_t did, const char *name); 52 | extern int delete(AFPObj *obj, uint16_t vid, cnid_t did, const char *name); 53 | extern int enumerate(AFPObj *obj, uint16_t vid, cnid_t did); 54 | extern uint16_t openvol(AFPObj *obj, const char *name); 55 | 56 | #endif /* AFPFUNC_HELPERS */ 57 | -------------------------------------------------------------------------------- /test/afpd/subtests.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifdef HAVE_CONFIG_H 16 | #include "config.h" 17 | #endif /* HAVE_CONFIG_H */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "directory.h" 34 | #include "dircache.h" 35 | #include "hash.h" 36 | #include "afp_config.h" 37 | #include "volume.h" 38 | 39 | #include "test.h" 40 | #include "subtests.h" 41 | 42 | static int reti; /* for the TEST_int macro */ 43 | 44 | int test001_add_x_dirs(const struct vol *vol, cnid_t start, cnid_t end) 45 | { 46 | struct dir *dir; 47 | char dirname[20]; 48 | while (start++ < end) { 49 | sprintf(dirname, "dir%04u", start); 50 | dir = dir_new(dirname, dirname, vol, DIRDID_ROOT, htonl(start), bfromcstr(vol->v_path), 0); 51 | if (dir == NULL) 52 | return -1; 53 | if (dircache_add(vol, dir) != 0) 54 | return -1; 55 | } 56 | 57 | return 0; 58 | } 59 | 60 | int test002_rem_x_dirs(const struct vol *vol, cnid_t start, cnid_t end) 61 | { 62 | struct dir *dir; 63 | while (start++ < end) { 64 | if ((dir = dircache_search_by_did(vol, htonl(start)))) 65 | if (dir_remove(vol, dir) != 0) 66 | return -1; 67 | } 68 | 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /test/afpd/subtests.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Frank Lahm 3 | 4 | This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | */ 14 | 15 | #ifndef SUBTESTS_H 16 | #define SUBTESTS_H 17 | 18 | #ifdef HAVE_CONFIG_H 19 | #include "config.h" 20 | #endif /* HAVE_CONFIG_H */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include "directory.h" 37 | #include "dircache.h" 38 | #include "hash.h" 39 | #include "afp_config.h" 40 | #include "volume.h" 41 | 42 | extern int test001_add_x_dirs(const struct vol *vol, cnid_t start, cnid_t end); 43 | extern int test002_rem_x_dirs(const struct vol *vol, cnid_t start, cnid_t end); 44 | #endif /* SUBTESTS_H */ 45 | -------------------------------------------------------------------------------- /test/afpd/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ ! -d /tmp/AFPtestvolume ] ; then 3 | mkdir -p /tmp/AFPtestvolume 4 | if [ $? -ne 0 ] ; then 5 | echo Error creating AFP test volume /tmp/AFPtestvolume 6 | exit 1 7 | fi 8 | fi 9 | 10 | if [ ! -f test.conf ] ; then 11 | echo -n "Creating configuration template ... " 12 | cat > test.conf <