]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/afp_dsi.c
AFP replay cache, first shot
[netatalk.git] / etc / afpd / afp_dsi.c
1 /*
2  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
3  * Copyright (c) 1990,1993 Regents of The University of Michigan.
4  * All Rights Reserved.  See COPYRIGHT.
5  *
6  * modified from main.c. this handles afp over tcp.
7  */
8
9 #ifdef HAVE_CONFIG_H
10 #include "config.h"
11 #endif /* HAVE_CONFIG_H */
12
13 #include <stdio.h>
14 #include <stdlib.h>
15 #include <signal.h>
16 #include <string.h>
17 #include <errno.h>
18 #ifdef HAVE_UNISTD_H
19 #include <unistd.h>
20 #endif /* HAVE_UNISTD_H */
21 #include <sys/socket.h>
22 #include <sys/time.h>
23 #ifdef HAVE_SYS_STAT_H
24 #include <sys/stat.h>
25 #endif /* HAVE_SYS_STAT_H */
26 #include <netinet/in.h>
27 #include <arpa/inet.h>
28 #include <atalk/logger.h>
29
30 #include <atalk/dsi.h>
31 #include <atalk/compat.h>
32 #include <atalk/util.h>
33
34 #include "globals.h"
35 #include "switch.h"
36 #include "auth.h"
37 #include "fork.h"
38 #include "dircache.h"
39
40 #ifdef FORCE_UIDGID
41 #warning UIDGID
42 #include "uid.h"
43 #endif /* FORCE_UIDGID */
44
45 #define CHILD_DIE          (1 << 0)
46 #define CHILD_RUNNING      (1 << 1)
47 #define CHILD_SLEEPING     (1 << 2)
48 #define CHILD_DATA         (1 << 3)
49 #define CHILD_DISCONNECTED (1 << 4)
50
51 /* 
52  * We generally pass this from afp_over_dsi to all afp_* funcs, so it should already be
53  * available everywhere. Unfortunately some funcs (eg acltoownermode) need acces to it
54  * but are deeply nested in the function chain with the caller already without acces to it.
55  * Changing this would require adding a reference to the caller which itself might be
56  * called in many places (eg acltoownermode is called from accessmode).
57  * The only sane way out is providing a copy of it here:
58  */
59 AFPObj *AFPobj = NULL;
60
61 static struct {
62     AFPObj *obj;
63     unsigned char flags;
64     int tickle;
65 } child;
66
67 typedef struct {
68     uint16_t DSIreqID;
69     uint8_t  AFPcommand;
70     uint32_t result;
71 } rc_elem_t;
72
73 /*
74  * AFP replay cache:
75  * - fix sized array
76  * - indexed just by taking DSIreqID mod REPLAYCACHE_SIZE
77  */
78 rc_elem_t replaycache[REPLAYCACHE_SIZE];
79
80 static void afp_dsi_close(AFPObj *obj)
81 {
82     DSI *dsi = obj->handle;
83
84     close(obj->ipc_fd);
85     obj->ipc_fd = -1;
86
87     /* we may have been called from a signal handler caught when afpd was running
88      * as uid 0, that's the wrong user for volume's prexec_close scripts if any,
89      * restore our login user
90      */
91     if (geteuid() != obj->uid) {
92         if (seteuid( obj->uid ) < 0) {
93             LOG(log_error, logtype_afpd, "can't seteuid(%u) back %s: uid: %u, euid: %u", 
94                 obj->uid, strerror(errno), getuid(), geteuid());
95             exit(EXITERR_SYS);
96         }
97     }
98
99     close_all_vol();
100     if (obj->logout)
101         (*obj->logout)();
102
103     LOG(log_info, logtype_afpd, "AFP statistics: %.2f KB read, %.2f KB written",
104         dsi->read_count/1024.0, dsi->write_count/1024.0);
105     log_dircache_stat();
106
107     dsi_close(dsi);
108 }
109
110 /* -------------------------------
111  * SIGTERM
112  * a little bit of code duplication. 
113  */
114 static void afp_dsi_die(int sig)
115 {
116 static volatile int in_handler;
117     
118     if (in_handler) {
119         return;
120     }
121     /* it's not atomic but we don't care because it's an exit function
122      * ie if a signal is received here, between the test and the affectation,
123      * it will not return.
124     */
125     in_handler = 1;
126
127     dsi_attention(child.obj->handle, AFPATTN_SHUTDOWN);
128     afp_dsi_close(child.obj);
129     if (sig) /* if no signal, assume dieing because logins are disabled &
130                 don't log it (maintenance mode)*/
131         LOG(log_info, logtype_afpd, "Connection terminated");
132     if (sig == SIGTERM || sig == SIGALRM) {
133         exit( 0 );
134     }
135     else {
136         exit(sig);
137     }
138 }
139
140 static void afp_dsi_transfer_session(int sig _U_)
141 {
142     uint16_t dsiID;
143     int socket;
144     DSI *dsi = (DSI *)child.obj->handle;
145
146     LOG(log_note, logtype_afpd, "afp_dsi_transfer_session: got SIGURG, trying to receive session fd");
147
148     if (readt(child.obj->ipc_fd, &dsiID, 2, 0, 2) != 2) {
149         LOG(log_error, logtype_afpd, "afp_dsi_transfer_session: couldn't receive DSI id, goodbye");
150         afp_dsi_close(child.obj);
151         exit(EXITERR_SYS);
152     }
153
154     if ((socket = recv_fd(child.obj->ipc_fd, 1)) == -1) {
155         LOG(log_error, logtype_afpd, "afp_dsi_transfer_session: couldn't receive session fd, goodbye");
156         afp_dsi_close(child.obj);
157         exit(EXITERR_SYS);
158     }
159
160     close(dsi->socket);
161     dsi->socket = socket;
162     dsi->header.dsi_requestID = dsiID;
163     dsi->header.dsi_len = 0;
164     dsi->header.dsi_code = AFP_OK;
165     dsi->header.dsi_command = DSIFUNC_CMD;
166     dsi->header.dsi_flags = DSIFL_REPLY;
167
168     if (!dsi_cmdreply(dsi, AFP_OK)) {
169         LOG(log_error, logtype_afpd, "dsi_cmdreply: %s", strerror(errno) );
170         afp_dsi_close(child.obj);
171         exit(EXITERR_CLNT);
172     }
173
174
175     LOG(log_note, logtype_afpd, "afp_dsi_transfer_session: succesfull primary reconnect");
176     /* 
177      * Now returning from this signal handler return to dsi_receive which should start
178      * reading/continuing from the connected socket that was passed via the parent from
179      * another session. The parent will terminate that session.
180      */
181 }
182
183 /* */
184 static void afp_dsi_sleep(void)
185 {
186     child.flags |= CHILD_SLEEPING;
187     dsi_sleep(child.obj->handle, 1);
188 }
189
190 /* ------------------- */
191 static void afp_dsi_timedown(int sig _U_)
192 {
193     struct sigaction    sv;
194     struct itimerval    it;
195
196     child.flags |= CHILD_DIE;
197     /* shutdown and don't reconnect. server going down in 5 minutes. */
198     setmessage("The server is going down for maintenance.");
199     if (dsi_attention(child.obj->handle, AFPATTN_SHUTDOWN | AFPATTN_NORECONNECT |
200                   AFPATTN_MESG | AFPATTN_TIME(5)) < 0) {
201         DSI *dsi = (DSI *) child.obj->handle;
202         dsi->down_request = 1;
203     }                  
204
205     it.it_interval.tv_sec = 0;
206     it.it_interval.tv_usec = 0;
207     it.it_value.tv_sec = 300;
208     it.it_value.tv_usec = 0;
209
210     if ( setitimer( ITIMER_REAL, &it, NULL ) < 0 ) {
211         LOG(log_error, logtype_afpd, "afp_timedown: setitimer: %s", strerror(errno) );
212         afp_dsi_die(EXITERR_SYS);
213     }
214     memset(&sv, 0, sizeof(sv));
215     sv.sa_handler = afp_dsi_die;
216     sigemptyset( &sv.sa_mask );
217     sigaddset(&sv.sa_mask, SIGHUP);
218     sigaddset(&sv.sa_mask, SIGTERM);
219     sv.sa_flags = SA_RESTART;
220     if ( sigaction( SIGALRM, &sv, NULL ) < 0 ) {
221         LOG(log_error, logtype_afpd, "afp_timedown: sigaction: %s", strerror(errno) );
222         afp_dsi_die(EXITERR_SYS);
223     }
224
225     /* ignore myself */
226     sv.sa_handler = SIG_IGN;
227     sigemptyset( &sv.sa_mask );
228     sv.sa_flags = SA_RESTART;
229     if ( sigaction( SIGUSR1, &sv, NULL ) < 0 ) {
230         LOG(log_error, logtype_afpd, "afp_timedown: sigaction SIGHUP: %s", strerror(errno) );
231         afp_dsi_die(EXITERR_SYS);
232     }
233 }
234
235 /* ---------------------------------
236  * SIGHUP reload configuration file
237  */
238 volatile int reload_request = 0;
239
240 static void afp_dsi_reload(int sig _U_)
241 {
242     reload_request = 1;
243 }
244
245 /* ---------------------------------
246  * SIGINT: enable max_debug LOGging
247  */
248 static volatile sig_atomic_t debug_request = 0;
249
250 static void afp_dsi_debug(int sig _U_)
251 {
252     debug_request = 1;
253 }
254
255 /* ---------------------- */
256 #ifdef SERVERTEXT
257 static void afp_dsi_getmesg (int sig _U_)
258 {
259     DSI *dsi = (DSI *) child.obj->handle;
260
261     dsi->msg_request = 1;
262     if (dsi_attention(child.obj->handle, AFPATTN_MESG | AFPATTN_TIME(5)) < 0)
263         dsi->msg_request = 2;
264 }
265 #endif /* SERVERTEXT */
266
267 static void alarm_handler(int sig _U_)
268 {
269     int err;
270     DSI *dsi = (DSI *) child.obj->handle;
271
272     if (child.flags & CHILD_DISCONNECTED) {
273         LOG(log_note, logtype_afpd, "afp_alarm: no reconnect within 10 hours, goodbye");
274         afp_dsi_die(EXITERR_CLNT);
275     }
276
277     /* we have to restart the timer because some libraries may use alarm() */
278     setitimer(ITIMER_REAL, &dsi->timer, NULL);
279
280     /* we got some traffic from the client since the previous timer 
281      * tick. */
282     if ((child.flags & CHILD_DATA)) {
283         child.flags &= ~CHILD_DATA;
284         child.flags &= ~CHILD_DISCONNECTED;
285        return;
286     }
287
288     /* if we're in the midst of processing something,
289        don't die. */
290     if ((child.flags & CHILD_SLEEPING) && child.tickle++ < child.obj->options.sleep) {
291         return;
292     } 
293         
294     if ((child.flags & CHILD_RUNNING) || (child.tickle++ < child.obj->options.timeout)) {
295         if (!(err = pollvoltime(child.obj)))
296             err = dsi_tickle(child.obj->handle);
297         if (err <= 0) 
298             afp_dsi_die(EXITERR_CLNT);
299     } else { /* didn't receive a tickle, enter disconnected state */
300         LOG(log_error, logtype_afpd, "afp_alarm: child timed out, entering disconnected state");
301         struct itimerval t = {{0, 60 * 60 * 10}, {0, 0}}; /* 10 hours */
302         setitimer(ITIMER_REAL, &t, NULL);
303         child.flags |= CHILD_DISCONNECTED;
304     }
305 }
306
307 /* ----------------- 
308    if dsi->in_write is set attention, tickle (and close?) msg
309    aren't sent. We don't care about tickle 
310 */
311 static void pending_request(DSI *dsi)
312 {
313     /* send pending attention */
314
315     /* read msg if any, it could be done in afp_getsrvrmesg */
316     if (dsi->msg_request) {
317         if (dsi->msg_request == 2) {
318             /* didn't send it in signal handler */
319             dsi_attention(child.obj->handle, AFPATTN_MESG | AFPATTN_TIME(5));
320         }
321         dsi->msg_request = 0;
322         readmessage(child.obj);
323     }
324     if (dsi->down_request) {
325         dsi->down_request = 0;
326         dsi_attention(child.obj->handle, AFPATTN_SHUTDOWN | AFPATTN_NORECONNECT |
327                   AFPATTN_MESG | AFPATTN_TIME(5));
328     }
329 }
330
331 /* -------------------------------------------
332  afp over dsi. this never returns. 
333 */
334 void afp_over_dsi(AFPObj *obj)
335 {
336     DSI *dsi = (DSI *) obj->handle;
337     int rc_idx;
338     u_int32_t err, cmd;
339     u_int8_t function;
340     struct sigaction action;
341
342     AFPobj = obj;
343     obj->exit = afp_dsi_die;
344     obj->reply = (int (*)()) dsi_cmdreply;
345     obj->attention = (int (*)(void *, AFPUserBytes)) dsi_attention;
346
347     obj->sleep = afp_dsi_sleep;
348     child.obj = obj;
349     child.tickle = child.flags = 0;
350
351     memset(&action, 0, sizeof(action));
352
353     /* install SIGHUP */
354     action.sa_handler = afp_dsi_reload;
355     sigemptyset( &action.sa_mask );
356     sigaddset(&action.sa_mask, SIGALRM);
357     sigaddset(&action.sa_mask, SIGTERM);
358     sigaddset(&action.sa_mask, SIGUSR1);
359     sigaddset(&action.sa_mask, SIGINT);
360 #ifdef SERVERTEXT
361     sigaddset(&action.sa_mask, SIGUSR2);
362 #endif    
363     action.sa_flags = SA_RESTART;
364     if ( sigaction( SIGHUP, &action, NULL ) < 0 ) {
365         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
366         afp_dsi_die(EXITERR_SYS);
367     }
368
369     /* install SIGURG */
370     action.sa_handler = afp_dsi_transfer_session;
371     sigemptyset( &action.sa_mask );
372     sigaddset(&action.sa_mask, SIGALRM);
373     sigaddset(&action.sa_mask, SIGTERM);
374     sigaddset(&action.sa_mask, SIGUSR1);
375     sigaddset(&action.sa_mask, SIGINT);
376 #ifdef SERVERTEXT
377     sigaddset(&action.sa_mask, SIGUSR2);
378 #endif    
379     action.sa_flags = SA_RESTART;
380     if ( sigaction( SIGURG, &action, NULL ) < 0 ) {
381         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
382         afp_dsi_die(EXITERR_SYS);
383     }
384
385     /* install SIGTERM */
386     action.sa_handler = afp_dsi_die;
387     sigemptyset( &action.sa_mask );
388     sigaddset(&action.sa_mask, SIGALRM);
389     sigaddset(&action.sa_mask, SIGHUP);
390     sigaddset(&action.sa_mask, SIGUSR1);
391     sigaddset(&action.sa_mask, SIGINT);
392 #ifdef SERVERTEXT
393     sigaddset(&action.sa_mask, SIGUSR2);
394 #endif    
395     action.sa_flags = SA_RESTART;
396     if ( sigaction( SIGTERM, &action, NULL ) < 0 ) {
397         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
398         afp_dsi_die(EXITERR_SYS);
399     }
400
401 #ifdef SERVERTEXT
402     /* Added for server message support */
403     action.sa_handler = afp_dsi_getmesg;
404     sigemptyset( &action.sa_mask );
405     sigaddset(&action.sa_mask, SIGALRM);
406     sigaddset(&action.sa_mask, SIGTERM);
407     sigaddset(&action.sa_mask, SIGUSR1);
408     sigaddset(&action.sa_mask, SIGHUP);
409     sigaddset(&action.sa_mask, SIGINT);
410     action.sa_flags = SA_RESTART;
411     if ( sigaction( SIGUSR2, &action, NULL) < 0 ) {
412         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
413         afp_dsi_die(EXITERR_SYS);
414     }
415 #endif /* SERVERTEXT */
416
417     /*  SIGUSR1 - set down in 5 minutes  */
418     action.sa_handler = afp_dsi_timedown;
419     sigemptyset( &action.sa_mask );
420     sigaddset(&action.sa_mask, SIGALRM);
421     sigaddset(&action.sa_mask, SIGHUP);
422     sigaddset(&action.sa_mask, SIGTERM);
423     sigaddset(&action.sa_mask, SIGINT);
424 #ifdef SERVERTEXT
425     sigaddset(&action.sa_mask, SIGUSR2);
426 #endif    
427     action.sa_flags = SA_RESTART;
428     if ( sigaction( SIGUSR1, &action, NULL) < 0 ) {
429         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
430         afp_dsi_die(EXITERR_SYS);
431     }
432
433     /*  SIGINT - enable max_debug LOGging to /tmp/afpd.PID.XXXXXX */
434     action.sa_handler = afp_dsi_debug;
435     sigfillset( &action.sa_mask );
436     action.sa_flags = SA_RESTART;
437     if ( sigaction( SIGINT, &action, NULL) < 0 ) {
438         LOG(log_error, logtype_afpd, "afp_over_dsi: sigaction: %s", strerror(errno) );
439         afp_dsi_die(EXITERR_SYS);
440     }
441
442 #ifndef DEBUGGING
443     /* tickle handler */
444     action.sa_handler = alarm_handler;
445     sigemptyset(&action.sa_mask);
446     sigaddset(&action.sa_mask, SIGHUP);
447     sigaddset(&action.sa_mask, SIGTERM);
448     sigaddset(&action.sa_mask, SIGUSR1);
449     sigaddset(&action.sa_mask, SIGINT);
450 #ifdef SERVERTEXT
451     sigaddset(&action.sa_mask, SIGUSR2);
452 #endif    
453     action.sa_flags = SA_RESTART;
454     if ((sigaction(SIGALRM, &action, NULL) < 0) ||
455             (setitimer(ITIMER_REAL, &dsi->timer, NULL) < 0)) {
456         afp_dsi_die(EXITERR_SYS);
457     }
458 #endif /* DEBUGGING */
459
460     if (dircache_init(obj->options.dircachesize) != 0)
461         afp_dsi_die(EXITERR_SYS);
462
463     /* get stuck here until the end */
464     while ((cmd = dsi_receive(dsi))) {
465         child.tickle = 0;
466         child.flags &= ~CHILD_SLEEPING;
467         dsi_sleep(dsi, 0); /* wake up */
468
469         if (reload_request) {
470             reload_request = 0;
471             load_volumes(child.obj);
472             dircache_dump();
473             log_dircache_stat();
474         }
475
476         /* The first SIGINT enables debugging, the next restores the config */
477         if (debug_request) {
478             static int debugging = 0;
479             debug_request = 0;
480
481             if (debugging) {
482                 if (obj->options.logconfig)
483                     setuplog(obj->options.logconfig);
484                 else
485                     setuplog("default log_note");
486                 debugging = 0;
487             } else {
488                 char logstr[50];
489                 debugging = 1;
490                 sprintf(logstr, "default log_maxdebug /tmp/afpd.%u.XXXXXX", getpid());
491                 setuplog(logstr);
492             }
493         }
494
495         if (cmd == DSIFUNC_TICKLE) {
496             /* timer is not every 30 seconds anymore, so we don't get killed on the client side. */
497             if ((child.flags & CHILD_DIE))
498                 dsi_tickle(dsi);
499             pending_request(dsi);
500             continue;
501         } 
502
503         child.flags |= CHILD_DATA;
504         switch(cmd) {
505         case DSIFUNC_CLOSE:
506             afp_dsi_close(obj);
507             LOG(log_info, logtype_afpd, "done");
508             return;
509             break;
510
511         case DSIFUNC_CMD:
512 #ifdef AFS
513             if ( writtenfork ) {
514                 if ( flushfork( writtenfork ) < 0 ) {
515                     LOG(log_error, logtype_afpd, "main flushfork: %s", strerror(errno) );
516                 }
517                 writtenfork = NULL;
518             }
519 #endif /* AFS */
520
521             function = (u_char) dsi->commands[0];
522
523             /* AFP replay cache */
524             rc_idx = REPLAYCACHE_SIZE % dsi->clientID;
525             LOG(log_debug, logtype_afpd, "DSI request ID: %u", dsi->clientID);
526
527             if (replaycache[rc_idx].DSIreqID == dsi->clientID
528                 && replaycache[rc_idx].AFPcommand == function) {
529                 LOG(log_debug, logtype_afpd, "AFP Replay Cache match: id: %u / cmd: %s",
530                     dsi->clientID, AfpNum2name(function));
531                 err = replaycache[rc_idx].result;
532             /* AFP replay cache end */
533             } else {
534                 /* send off an afp command. in a couple cases, we take advantage
535                  * of the fact that we're a stream-based protocol. */
536                 if (afp_switch[function]) {
537                     dsi->datalen = DSI_DATASIZ;
538                     child.flags |= CHILD_RUNNING;
539
540                     LOG(log_debug, logtype_afpd, "<== Start AFP command: %s", AfpNum2name(function));
541
542                     err = (*afp_switch[function])(obj,
543                                                   (char *)&dsi->commands, dsi->cmdlen,
544                                                   (char *)&dsi->data, &dsi->datalen);
545
546                     LOG(log_debug, logtype_afpd, "==> Finished AFP command: %s -> %s",
547                         AfpNum2name(function), AfpErr2name(err));
548
549                     dir_free_invalid_q();
550
551 #ifdef FORCE_UIDGID
552                     /* bring everything back to old euid, egid */
553                     if (obj->force_uid)
554                         restore_uidgid ( &obj->uidgid );
555 #endif /* FORCE_UIDGID */
556                     child.flags &= ~CHILD_RUNNING;
557
558                     /* Add result to the AFP replay cache */
559                     replaycache[rc_idx].DSIreqID = dsi->clientID;
560                     replaycache[rc_idx].AFPcommand = function;
561                     replaycache[rc_idx].result = err;
562                 } else {
563                     LOG(log_error, logtype_afpd, "bad function %X", function);
564                     dsi->datalen = 0;
565                     err = AFPERR_NOOP;
566                 }
567             }
568
569             /* single shot toggle that gets set by dsi_readinit. */
570             if (dsi->noreply) {
571                 dsi->noreply = 0;
572                 break;
573             }
574
575             if (!dsi_cmdreply(dsi, err)) {
576                 LOG(log_error, logtype_afpd, "dsi_cmdreply(%d): %s", dsi->socket, strerror(errno) );
577                 afp_dsi_die(EXITERR_CLNT);
578             }
579             break;
580
581         case DSIFUNC_WRITE: /* FPWrite and FPAddIcon */
582             function = (u_char) dsi->commands[0];
583             if ( afp_switch[ function ] != NULL ) {
584                 dsi->datalen = DSI_DATASIZ;
585                 child.flags |= CHILD_RUNNING;
586
587                 LOG(log_debug, logtype_afpd, "<== Start AFP command: %s", AfpNum2name(function));
588
589                 err = (*afp_switch[function])(obj,
590                                               (char *)&dsi->commands, dsi->cmdlen,
591                                               (char *)&dsi->data, &dsi->datalen);
592
593                 LOG(log_debug, logtype_afpd, "==> Finished AFP command: %s -> %s",
594                     AfpNum2name(function), AfpErr2name(err));
595
596                 child.flags &= ~CHILD_RUNNING;
597 #ifdef FORCE_UIDGID
598                 /* bring everything back to old euid, egid */
599                 if (obj->force_uid)
600                     restore_uidgid ( &obj->uidgid );
601 #endif /* FORCE_UIDGID */
602             } else {
603                 LOG(log_error, logtype_afpd, "(write) bad function %x", function);
604                 dsi->datalen = 0;
605                 err = AFPERR_NOOP;
606             }
607
608             if (!dsi_wrtreply(dsi, err)) {
609                 LOG(log_error, logtype_afpd, "dsi_wrtreply: %s", strerror(errno) );
610                 afp_dsi_die(EXITERR_CLNT);
611             }
612             break;
613
614         case DSIFUNC_ATTN: /* attention replies */
615             break;
616
617             /* error. this usually implies a mismatch of some kind
618              * between server and client. if things are correct,
619              * we need to flush the rest of the packet if necessary. */
620         default:
621             LOG(log_info, logtype_afpd,"afp_dsi: spurious command %d", cmd);
622             dsi_writeinit(dsi, dsi->data, DSI_DATASIZ);
623             dsi_writeflush(dsi);
624             break;
625         }
626         pending_request(dsi);
627     }
628
629     /* error */
630     afp_dsi_die(EXITERR_CLNT);
631 }