]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/status.c
Merge master
[netatalk.git] / etc / afpd / status.c
1 /*
2  * Copyright (c) 1990,1993 Regents of The University of Michigan.
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 <stdio.h>
11 #include <stdlib.h>
12 #include <unistd.h>
13 #include <ctype.h>
14 #include <string.h>
15 #include <time.h>
16 #include <sys/types.h>
17 #include <sys/stat.h>
18 #include <fcntl.h>
19 #include <sys/socket.h>
20 #include <atalk/logger.h>
21
22 #if 0
23 #ifdef BSD4_4
24 #include <sys/param.h>
25 #ifndef HAVE_GETHOSTID
26 #include <sys/sysctl.h>
27 #endif /* HAVE_GETHOSTID */
28 #endif /* BSD4_4 */
29 #endif
30
31 #include <arpa/inet.h>
32
33 #include <atalk/dsi.h>
34 #include <atalk/unicode.h>
35 #include <atalk/util.h>
36
37 #include "globals.h"  /* includes <netdb.h> */
38 #include "status.h"
39 #include "afp_config.h"
40 #include "icon.h"
41
42 static   size_t maxstatuslen = 0;
43
44 static void status_flags(char *data, const int notif, const int ipok,
45                          const unsigned char passwdbits, const int dirsrvcs _U_, int flags)
46 {
47     uint16_t           status;
48
49     status = AFPSRVRINFO_COPY
50            | AFPSRVRINFO_SRVSIGNATURE
51            | AFPSRVRINFO_SRVMSGS
52            | AFPSRVRINFO_FASTBOZO
53            | AFPSRVRINFO_SRVRDIR
54            | AFPSRVRINFO_SRVUTF8
55            | AFPSRVRINFO_EXTSLEEP;
56
57     if (passwdbits & PASSWD_SET) /* some uams may not allow this. */
58         status |= AFPSRVRINFO_PASSWD;
59     if (passwdbits & PASSWD_NOSAVE)
60         status |= AFPSRVRINFO_NOSAVEPASSWD;
61     if (ipok) /* only advertise tcp/ip if we have a valid address */        
62         status |= AFPSRVRINFO_TCPIP;
63     if (notif) /* Default is yes */        
64         status |= AFPSRVRINFO_SRVNOTIFY;
65     if (flags & OPTION_UUID)
66         status |= AFPSRVRINFO_UUID;
67
68     status = htons(status);
69     memcpy(data + AFPSTATUS_FLAGOFF, &status, sizeof(status));
70 }
71
72 static int status_server(char *data, const char *server, const struct afp_options *options)
73 {
74     char                *start = data;
75     char                *Obj, *Type, *Zone;
76     char                buf[32];
77     u_int16_t           status;
78     size_t              len;
79
80     /* make room for all offsets before server name */
81     data += AFPSTATUS_PRELEN;
82
83     /* extract the obj part of the server */
84     Obj = (char *) server;
85     if ((size_t)-1 == (len = convert_string( 
86                            options->unixcharset, options->maccharset, 
87                            Obj, -1, buf, sizeof(buf))) ) {
88         len = MIN(strlen(Obj), 31);
89         *data++ = len;
90         memcpy( data, Obj, len );
91         LOG ( log_error, logtype_afpd, "Could not set servername, using fallback");
92     } else {
93         *data++ = len;
94         memcpy( data, buf, len );
95     }
96     if ((len + 1) & 1) /* pad server name and length byte to even boundary */
97         len++;
98     data += len;
99
100     /* make room for signature and net address offset. save location of
101      * signature offset. we're also making room for directory names offset
102      * and the utf-8 server name offset.
103      *
104      * NOTE: technically, we don't need to reserve space for the
105      * signature and net address offsets if they're not going to be
106      * used. as there are no offsets after them, it doesn't hurt to
107      * have them specified though. so, we just do that to simplify
108      * things.  
109      *
110      * NOTE2: AFP3.1 Documentation states that the directory names offset
111      * is a required feature, even though it can be set to zero.
112      */
113     len = data - start;
114     status = htons(len + AFPSTATUS_POSTLEN);
115     memcpy(start + AFPSTATUS_MACHOFF, &status, sizeof(status));
116     return len; /* return the offset to beginning of signature offset */
117 }
118
119 static void status_machine(char *data)
120 {
121     char                *start = data;
122     u_int16_t           status;
123     int                 len;
124 #ifdef AFS
125     const char          *machine = "afs";
126 #else /* !AFS */
127     const char          *machine = "Netatalk %s";
128 #endif /* AFS */
129     char buf[64];
130
131     memcpy(&status, start + AFPSTATUS_MACHOFF, sizeof(status));
132     data += ntohs( status );
133
134     //    len = strlen( machine );
135     len = snprintf(buf, 64, machine, VERSION);
136     *data++ = len;
137     memcpy( data, buf, len );
138     data += len;
139
140     status = htons(data - start);
141     memcpy(start + AFPSTATUS_VERSOFF, &status, sizeof(status));
142 }
143
144 /* server signature is a 16-byte quantity */
145 static u_int16_t status_signature(char *data, int *servoffset,
146                                   const struct afp_options *options)
147 {
148     char                 *status;
149     u_int16_t            offset, sigoff;
150
151     status = data;
152
153     /* get server signature offset */
154     memcpy(&offset, data + *servoffset, sizeof(offset));
155     sigoff = offset = ntohs(offset);
156
157     /* jump to server signature offset */
158     data += offset;
159
160     memset(data, 0, 16);
161     memcpy(data, options->signature, 16);
162     data += 16;
163
164     /* calculate net address offset */
165     *servoffset += sizeof(offset);
166     offset = htons(data - status);
167     memcpy(status + *servoffset, &offset, sizeof(offset));
168     return sigoff;
169 }
170
171 static size_t status_netaddress(char *data, int *servoffset,
172                              const DSI *dsi,
173                              const struct afp_options *options)
174 {
175     char               *begin;
176     u_int16_t          offset;
177     size_t             addresses_len = 0;
178
179     begin = data;
180
181     /* get net address offset */
182     memcpy(&offset, data + *servoffset, sizeof(offset));
183     data += ntohs(offset);
184
185     /* format:
186        Address count (byte) 
187        len (byte = sizeof(length + address type + address) 
188        address type (byte, ip address = 0x01, ip + port = 0x02,
189                            ddp address = 0x03, fqdn = 0x04) 
190        address (up to 254 bytes, ip = 4, ip + port = 6, ddp = 4)
191        */
192
193     /* number of addresses. this currently screws up if we have a dsi
194        connection, but we don't have the ip address. to get around this,
195        we turn off the status flag for tcp/ip. */
196     *data++ = ((options->fqdn && dsi)? 1 : 0) + (dsi ? 1 : 0) +
197               (((options->flags & OPTION_ANNOUNCESSH) && options->fqdn && dsi)? 1 : 0);
198
199     /* ip address */
200     if (dsi) {
201         if (dsi->server.ss_family == AF_INET) { /* IPv4 */
202             const struct sockaddr_in *inaddr = (struct sockaddr_in *)&dsi->server;
203             if (inaddr->sin_port == htons(DSI_AFPOVERTCP_PORT)) {
204                 *data++ = 6; /* length */
205                 *data++ = 0x01; /* basic ip address */
206                 memcpy(data, &inaddr->sin_addr.s_addr,
207                        sizeof(inaddr->sin_addr.s_addr));
208                 data += sizeof(inaddr->sin_addr.s_addr);
209                 addresses_len += 7;
210             } else {
211                 /* ip address + port */
212                 *data++ = 8;
213                 *data++ = 0x02; /* ip address with port */
214                 memcpy(data, &inaddr->sin_addr.s_addr,
215                        sizeof(inaddr->sin_addr.s_addr));
216                 data += sizeof(inaddr->sin_addr.s_addr);
217                 memcpy(data, &inaddr->sin_port, sizeof(inaddr->sin_port));
218                 data += sizeof(inaddr->sin_port);
219                 addresses_len += 9;
220             }
221         } else { /* IPv6 */
222             const struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)&dsi->server;
223             if (sa6->sin6_port == htons(DSI_AFPOVERTCP_PORT)) {
224                 *data++ = 18; /* length */
225                 *data++ = 6; /* type */
226                 memcpy(data, &sa6->sin6_addr.s6_addr, sizeof(sa6->sin6_addr.s6_addr));
227                 data += sizeof(sa6->sin6_addr.s6_addr);
228                 addresses_len += 19;
229             } else {
230                 /* ip address + port */
231                 *data++ = 20; /* length */
232                 *data++ = 7; /* type*/
233                 memcpy(data, &sa6->sin6_addr.s6_addr, sizeof(sa6->sin6_addr.s6_addr));
234                 data += sizeof(sa6->sin6_addr.s6_addr);
235                 memcpy(data, &sa6->sin6_port, sizeof(sa6->sin6_port));
236                 data += sizeof(sa6->sin6_port);
237                 addresses_len += 21;
238             }
239
240         }
241     }
242
243     /* handle DNS names */
244     if (options->fqdn && dsi) {
245         size_t len = strlen(options->fqdn);
246         if ( len + 2 + addresses_len < maxstatuslen - offset) {
247             *data++ = len +2;
248             *data++ = 0x04;
249             memcpy(data, options->fqdn, len);
250             data += len;
251             addresses_len += len+2;
252         }
253
254         /* Annouce support for SSH tunneled AFP session, 
255          * this feature is available since 10.3.2.
256          * According to the specs (AFP 3.1 p.225) this should
257          * be an IP+Port style value, but it only works with 
258          * a FQDN. OSX Server uses FQDN as well.
259          */
260         if ( len + 2 + addresses_len < maxstatuslen - offset) {
261             if (options->flags & OPTION_ANNOUNCESSH) {
262                 *data++ = len +2;
263                 *data++ = 0x05;
264                 memcpy(data, options->fqdn, len);
265                 data += len;
266             }
267         }
268     }
269
270     /* calculate/store Directory Services Names offset */
271     offset = htons(data - begin); 
272     *servoffset += sizeof(offset);
273     memcpy(begin + *servoffset, &offset, sizeof(offset));
274
275     /* return length of buffer */
276     return (data - begin);
277 }
278
279 static size_t status_directorynames(char *data, int *diroffset, 
280                                  const DSI *dsi _U_, 
281                                  const struct afp_options *options)
282 {
283     char *begin = data;
284     u_int16_t offset;
285     memcpy(&offset, data + *diroffset, sizeof(offset));
286     offset = ntohs(offset);
287     data += offset;
288
289     /* I can not find documentation of any other purpose for the
290      * DirectoryNames field.
291      */
292     /*
293      * Try to synthesize a principal:
294      * service '/' fqdn '@' realm
295      */
296     if (options->k5service && options->k5realm && options->fqdn) {
297         /* should k5princ be utf8 encoded? */
298         size_t len;
299         char *p = strchr( options->fqdn, ':' );
300         if (p) 
301             *p = '\0';
302         len = strlen( options->k5service ) 
303                         + strlen( options->fqdn )
304                         + strlen( options->k5realm );
305         len+=2; /* '/' and '@' */
306         if ( len > 255 || len+2 > maxstatuslen - offset) {
307             *data++ = 0;
308             LOG ( log_error, logtype_afpd, "status: could not set directory service list, no more room");
309         }        
310         else {
311             *data++ = 1; /* DirectoryNamesCount */
312             *data++ = len;
313             snprintf( data, len + 1, "%s/%s@%s", options->k5service,
314                                 options->fqdn, options->k5realm );
315             data += len;
316             if (p)
317                 *p = ':';
318        }
319     } else {
320         *data++ = 0;
321     }
322
323     /* Calculate and store offset for UTF8ServerName */
324     *diroffset += sizeof(u_int16_t);
325     offset = htons(data - begin);
326     memcpy(begin + *diroffset, &offset, sizeof(u_int16_t));
327
328     /* return length of buffer */
329     return (data - begin);
330 }
331
332 static size_t status_utf8servername(char *data, int *nameoffset,
333                                  const DSI *dsi _U_,
334                                  const struct afp_options *options)
335 {
336     char *Obj, *Type, *Zone;
337     u_int16_t namelen;
338     size_t len;
339     char *begin = data;
340     u_int16_t offset, status;
341
342     memcpy(&offset, data + *nameoffset, sizeof(offset));
343     offset = ntohs(offset);
344     data += offset;
345
346     /* FIXME:
347      * What is the valid character range for an nbpname?
348      *
349      * Apple's server likes to use the non-qualified hostname
350      * This obviously won't work very well if multiple servers are running
351      * on the box.
352      */
353
354     /* extract the obj part of the server */
355     Obj = (char *) (options->server ? options->server : options->hostname);
356     if ((size_t) -1 == (len = convert_string (
357                             options->unixcharset, CH_UTF8_MAC, 
358                             Obj, -1, data+sizeof(namelen), maxstatuslen-offset )) ) {
359         LOG ( log_error, logtype_afpd, "Could not set utf8 servername");
360
361         /* set offset to 0 */
362         memset(begin + *nameoffset, 0, sizeof(offset));
363         data = begin + offset;
364     } else {
365         namelen = htons(len);
366         memcpy( data, &namelen, sizeof(namelen));
367         data += sizeof(namelen);
368         data += len;
369         offset = htons(offset);
370         memcpy(begin + *nameoffset, &offset, sizeof(u_int16_t));
371     }
372
373     /* return length of buffer */
374     return (data - begin);
375
376 }
377
378 /* returns actual offset to signature */
379 static void status_icon(char *data, const unsigned char *icondata,
380                         const int iconlen, const int sigoffset)
381 {
382     char                *start = data;
383     char                *sigdata = data + sigoffset;
384     u_int16_t           ret, status;
385
386     memcpy(&status, start + AFPSTATUS_ICONOFF, sizeof(status));
387     if ( icondata == NULL ) {
388         ret = status;
389         memset(start + AFPSTATUS_ICONOFF, 0, sizeof(status));
390     } else {
391         data += ntohs( status );
392         memcpy( data, icondata, iconlen);
393         data += iconlen;
394         ret = htons(data - start);
395     }
396
397     /* put in signature offset */
398     if (sigoffset)
399         memcpy(sigdata, &ret, sizeof(ret));
400 }
401
402 /* ---------------------
403  */
404 void status_init(AFPConfig *dsiconfig,
405                  const struct afp_options *options)
406 {
407     DSI *dsi;
408     char *status = NULL;
409     size_t statuslen;
410     int c, sigoff, ipok;
411
412     if (!dsiconfig || !options)
413         return;
414         
415     ipok = 0;
416     if (dsiconfig) {
417         status = dsiconfig->status;
418         maxstatuslen=sizeof(dsiconfig->status);
419         dsi = dsiconfig->obj.handle;
420         if (dsi->server.ss_family == AF_INET) { /* IPv4 */
421             const struct sockaddr_in *sa4 = (struct sockaddr_in *)&dsi->server;
422             ipok = sa4->sin_addr.s_addr ? 1 : 0;
423         } else { /* IPv6 */
424             const struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)&dsi->server;
425             for (int i=0; i<16; i++) {
426                 if (sa6->sin6_addr.s6_addr[i]) {
427                     ipok = 1;
428                     break;
429                 }
430             }
431         }
432     } else
433         dsi = NULL;
434
435     /*
436      * These routines must be called in order -- earlier calls
437      * set the offsets for later calls.
438      *
439      * using structs is a bad idea, but that's what the original code
440      * does. solaris, in fact, will segfault with them. so, now
441      * we just use the powers of #defines and memcpy.
442      *
443      * reply block layout (offsets are 16-bit quantities):
444      * machine type offset -> AFP version count offset ->
445      * UAM count offset -> vol icon/mask offset -> flags ->
446      *
447      * server name [padded to even boundary] -> signature offset ->
448      * network address offset ->
449      *
450      * at the appropriate offsets:
451      * machine type, afp versions, uams, server signature
452      * (16-bytes), network addresses, volume icon/mask 
453      */
454
455     status_flags(status,
456                  options->server_notif,
457                  (options->fqdn || ipok),
458                  options->passwdbits, 
459                  (options->k5service && options->k5realm && options->fqdn),
460                  options->flags);
461     /* returns offset to signature offset */
462     c = status_server(status, options->server ? options->server :
463                       options->hostname, options);
464     status_machine(status);
465     status_versions(status, dsi);
466     status_uams(status, options->uamlist);
467     if (options->flags & OPTION_CUSTOMICON)
468         status_icon(status, icon, sizeof(icon), c);
469     else
470         status_icon(status, apple_atalk_icon, sizeof(apple_atalk_icon), c);
471
472     sigoff = status_signature(status, &c, options);
473     /* c now contains the offset where the netaddress offset lives */
474
475     status_netaddress(status, &c, dsi, options);
476     /* c now contains the offset where the Directory Names Count offset lives */
477
478     statuslen = status_directorynames(status, &c, dsi, options);
479     /* c now contains the offset where the UTF-8 ServerName offset lives */
480
481     if ( statuslen < maxstatuslen) 
482         statuslen = status_utf8servername(status, &c, dsi, options);
483
484     if (dsiconfig) {
485         if ((options->flags & OPTION_CUSTOMICON) == 0) {
486             status_icon(status, apple_tcp_icon, sizeof(apple_tcp_icon), 0);
487         }
488         dsi_setstatus(dsi, status, statuslen);
489         dsiconfig->signature = status + sigoff;
490         dsiconfig->statuslen = statuslen;
491     }
492 }
493
494 /* set_signature()                                                    */
495 /*                                                                    */
496 /* If found in conf file, use it.                                     */
497 /* If not found in conf file, genarate and append in conf file.       */
498 /* If conf file don't exist, create and genarate.                     */
499 /* If cannot open conf file, use one-time signature.                  */
500 /* If -signature user:xxxxx, use it.                                  */
501
502 void set_signature(struct afp_options *options) {
503     char *usersign;
504     int fd, i;
505     struct stat tmpstat;
506     char *servername_conf;
507     int header = 0;
508     char buf[1024], *p;
509     FILE *fp = NULL, *randomp;
510     size_t len;
511     char *server_tmp;
512     
513     server_tmp = (options->server ? options->server : options->hostname);
514     if (strcmp(options->signatureopt, "auto") == 0) {
515         goto server_signature_auto;   /* default */
516     } else if (strcmp(options->signatureopt, "host") == 0) {
517         LOG(log_warning, logtype_afpd, "WARNING: option \"-signature host\" is obsoleted. Switching back to auto.", options->signatureopt);
518         goto server_signature_auto;   /* same as auto */
519     } else if (strncmp(options->signatureopt, "user", 4) == 0) {
520         goto server_signature_user;   /*  user string */
521     } else {
522         LOG(log_error, logtype_afpd, "ERROR: option \"-signature %s\" is not valid. Switching back to auto.", options->signatureopt);
523         goto server_signature_auto;   /* switch back to auto*/
524     }
525     
526 server_signature_user:
527     
528     /* Signature type is user string */
529     len = strlen(options->signatureopt);
530     if (len <= 5) {
531         LOG(log_warning, logtype_afpd, "WARNING: option \"-signature %s\" is not valid. Switching back to auto.", options->signatureopt);
532         goto server_signature_auto;
533     }
534     usersign = options->signatureopt + 5;
535     len = len - 5;
536     if (len > 16) {
537         LOG(log_warning, logtype_afpd, "WARNING: signature user string %s is very long !",  usersign);
538         len = 16;
539     } else if (len >= 3) {
540         LOG(log_info, logtype_afpd, "signature user string is %s.", usersign);
541     } else {
542         LOG(log_warning, logtype_afpd, "WARNING: signature user string %s is very short !",  usersign);
543     }
544     memset(options->signature, 0, 16);
545     memcpy(options->signature, usersign, len);
546     goto server_signature_done;
547     
548 server_signature_auto:
549     
550     /* Signature type is auto, using afp_signature.conf */
551     if (!stat(options->sigconffile, &tmpstat)) {                /* conf file exists? */
552         if ((fp = fopen(options->sigconffile, "r")) != NULL) {  /* read open? */
553             /* scan in the conf file */
554             while (fgets(buf, sizeof(buf), fp) != NULL) { 
555                 p = buf;
556                 while (p && isblank(*p))
557                     p++;
558                 if (!p || (*p == '#') || (*p == '\n'))
559                     continue;                             /* invalid line */
560                 if (*p == '"') {
561                     p++;
562                     if ((servername_conf = strtok( p, "\"" )) == NULL)
563                         continue;                         /* syntax error: invalid quoted servername */
564                 } else {
565                     if ((servername_conf = strtok( p, " \t" )) == NULL)
566                         continue;                         /* syntax error: invalid servername */
567                 }
568                 p = strchr(p, '\0');
569                 p++;
570                 if (*p == '\0')
571                     continue;                             /* syntax error: missing signature */
572                 
573                 if (strcmp(server_tmp, servername_conf))
574                     continue;                             /* another servername */
575                 
576                 while (p && isblank(*p))
577                     p++;
578                 if ( 16 == sscanf(p, "%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX%2hhX",
579                                   &options->signature[ 0], &options->signature[ 1],
580                                   &options->signature[ 2], &options->signature[ 3],
581                                   &options->signature[ 4], &options->signature[ 5],
582                                   &options->signature[ 6], &options->signature[ 7],
583                                   &options->signature[ 8], &options->signature[ 9],
584                                   &options->signature[10], &options->signature[11],
585                                   &options->signature[12], &options->signature[13],
586                                   &options->signature[14], &options->signature[15]
587                          )) {
588                     fclose(fp);
589                     goto server_signature_done;                 /* found in conf file */
590                 }
591             }
592             if ((fp = freopen(options->sigconffile, "a+", fp)) != NULL) { /* append because not found */
593                 fseek(fp, 0L, SEEK_END);
594                 if(ftell(fp) == 0) {                     /* size = 0 */
595                     header = 1;
596                     goto server_signature_random;
597                 } else {
598                     fseek(fp, -1L, SEEK_END);
599                     if(fgetc(fp) != '\n') fputc('\n', fp); /* last char is \n? */
600                     goto server_signature_random;
601                 }                    
602             } else {
603                 LOG(log_error, logtype_afpd, "ERROR: Cannot write in %s (%s). Using one-time signature.",
604                     options->sigconffile, strerror(errno));
605                 goto server_signature_random;
606             }
607         } else {
608             LOG(log_error, logtype_afpd, "ERROR: Cannot read %s (%s). Using one-time signature.",
609                 options->sigconffile, strerror(errno));
610             goto server_signature_random;
611         }
612     } else {                                                          /* conf file don't exist */
613         if (( fd = creat(options->sigconffile, 0644 )) < 0 ) {
614             LOG(log_error, logtype_afpd, "ERROR: Cannot create %s (%s). Using one-time signature.",
615                 options->sigconffile, strerror(errno));
616             goto server_signature_random;
617         }
618         if (( fp = fdopen( fd, "w" )) == NULL ) {
619             LOG(log_error, logtype_afpd, "ERROR: Cannot fdopen %s (%s). Using one-time signature.",
620                 options->sigconffile, strerror(errno));
621             close(fd);
622             goto server_signature_random;
623         }
624         header = 1;
625         goto server_signature_random;
626     }
627     
628 server_signature_random:
629     
630     /* generate signature from random number */
631     randombytes(options->signature, 16);
632
633     if (fp && header) { /* conf file is created or size=0 */
634         fprintf(fp, "# DON'T TOUCH NOR COPY THOUGHTLESSLY!\n");
635         fprintf(fp, "# This file is auto-generated by afpd.\n");
636         fprintf(fp, "# \n");
637         fprintf(fp, "# ServerSignature is unique identifier used to prevent logging on to\n");
638         fprintf(fp, "# the same server twice.\n");
639         fprintf(fp, "# \n");
640         fprintf(fp, "# If setting \"-signature user:xxxxx\" in afpd.conf, this file is not used.\n\n");
641     }
642     
643     if (fp) {
644         fprintf(fp, "\"%s\"\t", server_tmp);
645         for (i=0 ; i<16 ; i++) {
646             fprintf(fp, "%02X", (options->signature)[i]);
647         }
648         fprintf(fp, "%s", "\n");
649         fclose(fp);
650     }
651     
652 server_signature_done:
653     
654     /* retrun */
655     LOG(log_info, logtype_afpd,
656         " \"%s\"'s signature is  %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
657         server_tmp,
658         (options->signature)[ 0], (options->signature)[ 1],
659         (options->signature)[ 2], (options->signature)[ 3],
660         (options->signature)[ 4], (options->signature)[ 5],
661         (options->signature)[ 6], (options->signature)[ 7],
662         (options->signature)[ 8], (options->signature)[ 9],
663         (options->signature)[10], (options->signature)[11],
664         (options->signature)[12], (options->signature)[13],
665         (options->signature)[14], (options->signature)[15]);
666     
667     return;
668 }
669
670 /* this is the same as asp/dsi_getstatus */
671 int afp_getsrvrinfo(AFPObj *obj, char *ibuf _U_, size_t ibuflen _U_, char *rbuf, size_t *rbuflen)
672 {
673     AFPConfig *config = obj->config;
674
675     memcpy(rbuf, config->status, config->statuslen);
676     *rbuflen = config->statuslen;
677     return AFP_OK;
678 }