From: bfernhomberg Date: Wed, 9 Jun 2004 02:07:15 +0000 (+0000) Subject: add -advertise_ssh flag to afpd.conf, if set announce SSH tunneling capabilities. X-Git-Tag: netatalk-2-0-beta2~33 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=adcaa8dbe11175095495b3167c468620fa5a93f3;p=netatalk.git add -advertise_ssh flag to afpd.conf, if set announce SSH tunneling capabilities. --- diff --git a/etc/afpd/afp_options.c b/etc/afpd/afp_options.c index cad72ee2..ae426528 100644 --- a/etc/afpd/afp_options.c +++ b/etc/afpd/afp_options.c @@ -1,5 +1,5 @@ /* - * $Id: afp_options.c,v 1.30.2.2.2.7 2004-05-12 21:21:48 didg Exp $ + * $Id: afp_options.c,v 1.30.2.2.2.8 2004-06-09 02:07:15 bfernhomberg Exp $ * * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu) * Copyright (c) 1990,1993 Regents of The University of Michigan. @@ -221,6 +221,8 @@ int afp_options_parseline(char *buf, struct afp_options *options) options->flags &= ~OPTION_CUSTOMICON; if (strstr(buf, " -icon")) options->flags |= OPTION_CUSTOMICON; + if (strstr(buf, " -advertise_ssh")) + options->flags |= OPTION_ANNOUNCESSH; /* passwd bits */ if (strstr(buf, " -nosavepassword")) diff --git a/etc/afpd/globals.h b/etc/afpd/globals.h index 5b42bc1e..d800c49a 100644 --- a/etc/afpd/globals.h +++ b/etc/afpd/globals.h @@ -1,5 +1,5 @@ /* - * $Id: globals.h,v 1.18.2.2.2.3 2004-01-08 19:16:57 lenneis Exp $ + * $Id: globals.h,v 1.18.2.2.2.4 2004-06-09 02:07:15 bfernhomberg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -38,6 +38,7 @@ #define OPTION_PROXY (1 << 3) #define OPTION_CUSTOMICON (1 << 4) #define OPTION_NOSLP (1 << 5) +#define OPTION_ANNOUNCESSH (1 << 6) #ifdef FORCE_UIDGID /* set up a structure for this */ diff --git a/etc/afpd/status.c b/etc/afpd/status.c index 937b517f..2b96f87d 100644 --- a/etc/afpd/status.c +++ b/etc/afpd/status.c @@ -1,5 +1,5 @@ /* - * $Id: status.c,v 1.13.6.5 2004-06-09 01:31:14 bfernhomberg Exp $ + * $Id: status.c,v 1.13.6.6 2004-06-09 02:07:15 bfernhomberg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -230,7 +230,7 @@ server_signature_done: static int status_netaddress(char *data, int *servoffset, const ASP asp, const DSI *dsi, - const char *fqdn) + const struct afp_options *options) { char *begin; u_int16_t offset; @@ -252,7 +252,8 @@ static int status_netaddress(char *data, int *servoffset, /* number of addresses. this currently screws up if we have a dsi connection, but we don't have the ip address. to get around this, we turn off the status flag for tcp/ip. */ - *data++ = ((fqdn && dsi)? 1 : 0) + (dsi ? 1 : 0) + (asp ? 1 : 0); + *data++ = ((options->fqdn && dsi)? 1 : 0) + (dsi ? 1 : 0) + (asp ? 1 : 0) + + (((options->flags & OPTION_ANNOUNCESSH) && options->fqdn && dsi)? 1 : 0); /* ip address */ if (dsi) { @@ -277,12 +278,25 @@ static int status_netaddress(char *data, int *servoffset, } /* handle DNS names */ - if (fqdn && dsi) { - int len = strlen(fqdn); + if (options->fqdn && dsi) { + int len = strlen(options->fqdn); *data++ = len +2; *data++ = 0x04; - memcpy(data, fqdn, len); + memcpy(data, options->fqdn, len); data += len; + + /* Annouce support for SSH tunneled AFP session, + * this feature is available since 10.3.2. + * According to the specs (AFP 3.1 p.225) this should + * be an IP+Port style value, but it only works with + * a FQDN. OSX Server uses FQDN as well. + */ + if (options->flags & OPTION_ANNOUNCESSH) { + *data++ = len +2; + *data++ = 0x05; + memcpy(data, options->fqdn, len); + data += len; + } } #ifndef NO_DDP @@ -515,7 +529,7 @@ void status_init(AFPConfig *aspconfig, AFPConfig *dsiconfig, sigoff = status_signature(status, &c, dsi, options); /* c now contains the offset where the netaddress offset lives */ - status_netaddress(status, &c, asp, dsi, options->fqdn); + status_netaddress(status, &c, asp, dsi, options); /* c now contains the offset where the Directory Names Count offset lives */ statuslen = status_directorynames(status, &c, dsi, options);