/*
- * $Id: afp_dsi.c,v 1.26 2002-12-04 10:59:36 didg Exp $
+ * $Id: afp_dsi.c,v 1.27 2003-03-12 15:07:00 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
/* get stuck here until the end */
while ((cmd = dsi_receive(dsi))) {
child.tickle = 0;
+ dsi_sleep(dsi, 0); /* wake up */
if (cmd == DSIFUNC_TICKLE) {
/* so we don't get killed on the client side. */
/*
- * $Id: afp_util.c,v 1.2 2002-10-05 13:07:18 didg Exp $
+ * $Id: afp_util.c,v 1.3 2003-03-12 15:07:01 didg Exp $
*
* Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
* Copyright (c) 1990,1993 Regents of The University of Michigan.
case AFP_READ_EXT : return "AFP_READ_EXT"; /* 60 */
case AFP_WRITE_EXT : return "AFP_WRITE_EXT"; /* 61 */
case AFP_GETSESSTOKEN : return "AFP_GETSESSTOKEN"; /* 64 */
+ case AFP_LOGIN_EXT : return "AFP_LOGIN_EXT"; /* 63 */
case AFP_DISCTOLDSESS : return "AFP_DISCTOLDSESS"; /* 65 */
case AFP_ENUMERATE_EXT : return "AFP_ENUMERATE_EXT"; /* 66 */
case AFP_CATSEARCH_EXT : return "AFP_CATSEARCH_EXT"; /* 67 */
/* version 3.1 */
case AFP_ENUMERATE_EXT2: return "AFP_ENUMERATE_EXT2"; /* 68 */
+ case AFP_ZZZ : return "AFP_ZZZ"; /* 122 */
case AFP_ADDICON : return "AFP_ADDICON"; /* 192 */
}
/*
- * $Id: auth.c,v 1.41 2003-01-26 16:40:44 srittau Exp $
+ * $Id: auth.c,v 1.42 2003-03-12 15:07:02 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
enumerate_ext */
uam_afpserver_action(AFP_CATSEARCH_EXT, UAM_AFPSERVER_POSTAUTH, afp_catsearch, NULL);
uam_afpserver_action(AFP_GETSESSTOKEN, UAM_AFPSERVER_POSTAUTH, afp_getsession, NULL);
- uam_afpserver_action(AFP_DISCTOLDSESS, UAM_AFPSERVER_POSTAUTH, afp_disconnect, NULL);
uam_afpserver_action(AFP_READ_EXT, UAM_AFPSERVER_POSTAUTH, afp_read_ext, NULL);
uam_afpserver_action(AFP_WRITE_EXT, UAM_AFPSERVER_POSTAUTH, afp_write_ext, NULL);
+ uam_afpserver_action(AFP_DISCTOLDSESS, UAM_AFPSERVER_POSTAUTH, afp_disconnect, NULL);
+ uam_afpserver_action(AFP_ZZZ, UAM_AFPSERVER_POSTAUTH, afp_zzz, NULL);
+
break;
}
obj->logout = logout;
return( AFP_OK );
}
+/* ---------------------- */
+int afp_zzz (obj, ibuf, ibuflen, rbuf, rbuflen ) /* Function 122 */
+AFPObj *obj;
+char *ibuf, *rbuf;
+unsigned int ibuflen, *rbuflen;
+{
+ u_int32_t retdata;
+
+ *rbuflen = 0;
+
+ retdata = 1;
+ *rbuflen = sizeof(retdata);
+ retdata = htonl(retdata);
+ memcpy(rbuf, &retdata, sizeof(retdata));
+ if (obj->proto == AFPPROTO_DSI) {
+ DSI *dsi = obj->handle;
+ dsi_sleep(dsi, 1);
+ }
+ rbuf += sizeof(retdata);
+ return AFP_OK;
+}
+
/* ---------------------- */
int afp_getsession(obj, ibuf, ibuflen, rbuf, rbuflen )
AFPObj *obj;
/* memcpy (id, ibuf, idlen) */
}
break;
+ case 3: /* Jaguar */
+ case 4:
+ type = 0;
+ break;
}
*rbuflen = sizeof(type);
type = htons(type);
}
memcpy(&token, ibuf, tklen);
/* killed old session, not easy */
- return AFP_OK;
+ return AFPERR_SESSCLOS; /* was AFP_OK */
}
/* ---------------------- */
ibuflen -= len;
/* directory service name */
- if (!ibuflen)
+ if (!ibuflen)
return send_reply(obj, AFPERR_PARAM);
type = *ibuf;
ibuf++;
ibuflen--;
break;
case 3:
- if (ibuflen <= sizeof(len16))
+ /* With "No User Authen" it is equal */
+ if (ibuflen < sizeof(len16))
return send_reply(obj, AFPERR_PARAM);
-
memcpy(&len16, ibuf, sizeof(len16));
ibuf += sizeof(len16);
ibuflen -= sizeof(len16);
ibuf += len;
ibuflen -= len;
- if (!ibuflen )
- return send_reply(obj, AFPERR_PARAM);
-
/* Pad */
- if ((unsigned long) ibuf & 1) { /* pad character */
+ if (ibuflen && ((unsigned long) ibuf & 1)) { /* pad character */
ibuf++;
ibuflen--;
}
/*
- * $Id: auth.h,v 1.4 2002-10-16 02:20:41 didg Exp $
+ * $Id: auth.h,v 1.5 2003-03-12 15:07:02 didg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
extern int afp_getuserinfo __P((AFPObj *, char *, int, char *, int *));
extern int afp_getsession __P((AFPObj *, char *, unsigned int, char *, unsigned int *));
extern int afp_disconnect __P((AFPObj *, char *, int, char *, int *));
+extern int afp_zzz __P((AFPObj *, char *, unsigned int, char *, unsigned int *));
#endif /* auth.h */
/*
- * $Id: uams_guest.c,v 1.11 2002-10-13 06:18:14 didg Exp $
+ * $Id: uams_guest.c,v 1.12 2003-03-12 15:07:03 didg Exp $
*
* (c) 2001 (see COPYING)
*/
#include <atalk/afp.h>
#include <atalk/uam.h>
+/* login and login_ext are almost the same */
static int noauth_login(void *obj, struct passwd **uam_pwd,
char *ibuf, int ibuflen,
char *rbuf, int *rbuflen)
return( AFP_OK );
}
+static int noauth_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
+ char *ibuf, int ibuflen,
+ char *rbuf, int *rbuflen)
+{
+ return ( noauth_login (obj, uam_pwd, ibuf, ibuflen, rbuf, rbuflen));
+}
+
/* Printer NoAuthUAM Login */
int noauth_printer(start, stop, username, out)
static int uam_setup(const char *path)
{
- if (uam_register(UAM_SERVER_LOGIN, path, "No User Authent",
- noauth_login, NULL, NULL) < 0)
- return -1;
+ if (uam_register(UAM_SERVER_LOGIN_EXT, path, "No User Authent",
+ noauth_login, NULL, NULL, noauth_login_ext) < 0)
+ return -1;
+
if (uam_register(UAM_SERVER_PRINTAUTH, path, "NoAuthUAM",
noauth_printer) < 0)
return -1;
/* version 3.1 */
#define AFP_ENUMERATE_EXT2 68
+#define AFP_ZZZ 122
#endif
int statuslen;
unsigned int datalen, cmdlen;
size_t read_count, write_count;
+ int asleep; /* client won't reply AFP 0x7a ? */
/* inited = initialized?, child = a child?, noreply = send reply? */
char child, inited, noreply;
const char *program;
extern int dsi_tickle __P((DSI *));
extern void dsi_getstatus __P((DSI *));
extern void dsi_close __P((DSI *));
+extern void dsi_sleep __P((DSI *, const int ));
/* low-level stream commands -- in dsi_stream.c */
extern size_t dsi_stream_write __P((DSI *, void *, const size_t));
/*
- * $Id: dsi_attn.c,v 1.4 2002-12-04 10:59:37 didg Exp $
+ * $Id: dsi_attn.c,v 1.5 2003-03-12 15:07:05 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
u_int32_t len, nlen;
u_int16_t id;
+ if (dsi->asleep)
+ return 1;
+
id = htons(dsi_serverID(dsi));
flags = htons(flags);
len = MIN(sizeof(flags), dsi->attn_quantum);
/*
- * $Id: dsi_close.c,v 1.3 2001-06-29 14:14:46 rufustfirefly Exp $
+ * $Id: dsi_close.c,v 1.4 2003-03-12 15:07:06 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
void dsi_close(DSI *dsi)
{
/* server generated. need to set all the fields. */
- dsi->header.dsi_flags = DSIFL_REQUEST;
- dsi->header.dsi_command = DSIFUNC_CLOSE;
- dsi->header.dsi_requestID = htons(dsi_serverID(dsi));
- dsi->header.dsi_code = dsi->header.dsi_reserved = htonl(0);
- dsi->cmdlen = 0;
-
- dsi_send(dsi);
- dsi->proto_close(dsi);
+ if (!dsi->asleep) {
+ dsi->header.dsi_flags = DSIFL_REQUEST;
+ dsi->header.dsi_command = DSIFUNC_CLOSE;
+ dsi->header.dsi_requestID = htons(dsi_serverID(dsi));
+ dsi->header.dsi_code = dsi->header.dsi_reserved = htonl(0);
+ dsi->cmdlen = 0;
+ dsi_send(dsi);
+ dsi->proto_close(dsi);
+ }
free(dsi);
}
/*
- * $Id: dsi_stream.c,v 1.10 2003-01-12 14:40:05 didg Exp $
+ * $Id: dsi_stream.c,v 1.11 2003-03-12 15:07:06 didg Exp $
*
* Copyright (c) 1998 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
return stored;
}
+void dsi_sleep(DSI *dsi, const int state)
+{
+ dsi->asleep = state;
+}
/* write data. 0 on failure. this assumes that dsi_len will never
* cause an overflow in the data buffer. */
/*
- * $Id: dsi_tickle.c,v 1.4 2002-12-04 10:59:37 didg Exp $
+ * $Id: dsi_tickle.c,v 1.5 2003-03-12 15:07:07 didg Exp $
*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All rights reserved. See COPYRIGHT.
u_int16_t id;
int ret;
+ if (dsi->asleep)
+ return 1;
+
id = htons(dsi_serverID(dsi));
memset(block, 0, sizeof(block));