From: Art Cancro Date: Fri, 8 Apr 2005 19:36:56 +0000 (+0000) Subject: * Moved to the new string tokenizer API X-Git-Tag: v7.86~4956 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=abeb8adc38f9d55fcb6cb3d076f57239b0a9a4d5 * Moved to the new string tokenizer API --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 0bf77bbe6..f603ca4d1 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -1,4 +1,7 @@ $Log$ +Revision 610.1 2005/04/08 19:36:56 ajc +* Moved to the new string tokenizer API + Revision 610.0 2005/04/04 17:50:04 ajc * THIS IS 6.10 (unfinished first time install wizard has been disabled) @@ -2502,3 +2505,4 @@ Sun Dec 6 19:50:55 EST 1998 Art Cancro 1998-12-03 Nathan Bryant * webserver.c: warning fix + diff --git a/webcit/auth.c b/webcit/auth.c index a48e22771..3fb489847 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -77,7 +77,7 @@ void become_logged_in(char *user, char *pass, char *serv_response) char buf[SIZ]; WC->logged_in = 1; - extract(WC->wc_username, &serv_response[4], 0); + extract_token(WC->wc_username, &serv_response[4], 0, '|', sizeof WC->wc_username); strcpy(WC->wc_password, pass); WC->axlevel = extract_int(&serv_response[4], 1); if (WC->axlevel >= 6) { @@ -92,7 +92,7 @@ void become_logged_in(char *user, char *pass, char *serv_response) WC->new_mail = extract_int(&buf[4], 0); WC->need_regi = extract_int(&buf[4], 1); WC->need_vali = extract_int(&buf[4], 2); - extract(WC->cs_inet_email, &buf[4], 3); + extract_token(WC->cs_inet_email, &buf[4], 3, '|', sizeof WC->cs_inet_email); } } @@ -154,10 +154,10 @@ void do_login(void) void do_welcome(void) { char buf[SIZ]; +#ifdef XXX_NOT_FINISHED_YET_XXX FILE *fp; int i; -#ifdef XXX_NOT_FINISHED_YET_XXX /* * See if we have to run the first-time setup wizard */ @@ -193,7 +193,7 @@ void do_welcome(void) /* * Go to the user's preferred start page */ - get_preference("startpage", buf); + get_preference("startpage", buf, sizeof buf); if (strlen(buf)==0) { strcpy(buf, "/dotskip&room=_BASEROOM_"); set_preference("startpage", buf); diff --git a/webcit/calendar.c b/webcit/calendar.c index bb8afc103..10296ae79 100644 --- a/webcit/calendar.c +++ b/webcit/calendar.c @@ -232,7 +232,7 @@ void cal_process_object(icalcomponent *cal, serv_gets(buf); if (buf[0] == '1') { while (serv_gets(buf), strcmp(buf, "000")) { - extract(conflict_name, buf, 3); + extract_token(conflict_name, buf, 3, '|', sizeof conflict_name); is_update = extract_int(buf, 4); wprintf("%s" "" @@ -780,10 +780,10 @@ void display_using_handler(long msgnum, while (serv_gets(buf), strcmp(buf, "000")) { if (!strncasecmp(buf, "part=", 5)) { - extract(mime_filename, &buf[5], 1); - extract(mime_partnum, &buf[5], 2); - extract(mime_disposition, &buf[5], 3); - extract(mime_content_type, &buf[5], 4); + extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename); + extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum); + extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition); + extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type); mime_length = extract_int(&buf[5], 5); if (!strcasecmp(mime_content_type, "text/calendar")) { @@ -913,7 +913,7 @@ void do_freebusy(char *req) { char buf[SIZ]; char *fb; - extract_token(who, req, 1, ' '); + extract_token(who, req, 1, ' ', sizeof who); if (!strncasecmp(who, "/freebusy/", 10)) { strcpy(who, &who[10]); } diff --git a/webcit/context_loop.c b/webcit/context_loop.c index fdd97a819..9fd9ba8fe 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -298,7 +298,7 @@ void context_loop(int sock) */ if (!strncasecmp(buf, "Cookie: webcit=", 15)) { cookie_to_stuff(&buf[15], &desired_session, - NULL, NULL, NULL); + NULL, 0, NULL, 0, NULL, 0); got_cookie = 1; } @@ -307,8 +307,8 @@ void context_loop(int sock) */ if (!strncasecmp(buf, "Authorization: Basic ", 21)) { CtdlDecodeBase64(httpauth_string, &buf[21], strlen(&buf[21])); - extract_token(httpauth_user, httpauth_string, 0, ':'); - extract_token(httpauth_pass, httpauth_string, 1, ':'); + extract_token(httpauth_user, httpauth_string, 0, ':', sizeof httpauth_user); + extract_token(httpauth_pass, httpauth_string, 1, ':', sizeof httpauth_pass); } /* diff --git a/webcit/cookie_conversion.c b/webcit/cookie_conversion.c index 644dbfc32..27c4830d2 100644 --- a/webcit/cookie_conversion.c +++ b/webcit/cookie_conversion.c @@ -64,7 +64,10 @@ int xtoi(char *in, size_t len) /* * Extract all that fun stuff out of the cookie. */ -void cookie_to_stuff(char *cookie, int *session, char *user, char *pass, char *room) +void cookie_to_stuff(char *cookie, int *session, + char *user, size_t user_len, + char *pass, size_t pass_len, + char *room, size_t room_len) { char buf[SIZ]; int i, len; @@ -79,9 +82,9 @@ void cookie_to_stuff(char *cookie, int *session, char *user, char *pass, char *r if (session != NULL) *session = extract_int(buf, 0); if (user != NULL) - extract(user, buf, 1); + extract_token(user, buf, 1, '|', user_len); if (pass != NULL) - extract(pass, buf, 2); + extract_token(pass, buf, 2, '|', pass_len); if (room != NULL) - extract(room, buf, 3); + extract_token(room, buf, 3, '|', room_len); } diff --git a/webcit/event.c b/webcit/event.c index eff197c51..5634326ef 100644 --- a/webcit/event.c +++ b/webcit/event.c @@ -614,7 +614,7 @@ void save_individual_event(icalcomponent *supplied_vevent, long msgnum) { /* Now iterate! */ for (i=0; i 0) { lprintf(9, "Attendee: <%s>\n", buf); @@ -647,7 +647,7 @@ STARTOVER: lprintf(9, "Remove unlisted attendees\n"); striplt(attendee_string); foundit = 0; for (i=0; i
%d", floornum); diff --git a/webcit/groupdav_delete.c b/webcit/groupdav_delete.c index 16991b537..eebe1a0ce 100644 --- a/webcit/groupdav_delete.c +++ b/webcit/groupdav_delete.c @@ -42,7 +42,7 @@ void groupdav_delete(char *dav_pathname, char *dav_ifmatch) { /* Now extract the message euid */ n = num_tokens(dav_pathname, '/'); - extract_token(dav_uid, dav_pathname, n-1, '/'); + extract_token(dav_uid, dav_pathname, n-1, '/', sizeof dav_uid); remove_token(dav_pathname, n-1, '/'); /* What's left is the room name. Remove trailing slashes. */ diff --git a/webcit/groupdav_get.c b/webcit/groupdav_get.c index dafcc7653..87286632a 100644 --- a/webcit/groupdav_get.c +++ b/webcit/groupdav_get.c @@ -44,7 +44,7 @@ void groupdav_get(char *dav_pathname) { /* Now extract the message euid */ n = num_tokens(dav_pathname, '/'); - extract_token(dav_uid, dav_pathname, n-1, '/'); + extract_token(dav_uid, dav_pathname, n-1, '/', sizeof dav_uid); remove_token(dav_pathname, n-1, '/'); /* What's left is the room name. Remove trailing slashes. */ diff --git a/webcit/groupdav_main.c b/webcit/groupdav_main.c index a25bdc72e..21ef55bd8 100644 --- a/webcit/groupdav_main.c +++ b/webcit/groupdav_main.c @@ -150,8 +150,8 @@ void groupdav_main(struct httprequest *req, return; } - extract_token(dav_method, req->line, 0, ' '); - extract_token(dav_pathname, req->line, 1, ' '); + extract_token(dav_method, req->line, 0, ' ', sizeof dav_method); + extract_token(dav_pathname, req->line, 1, ' ', sizeof dav_pathname); unescape_input(dav_pathname); /* diff --git a/webcit/groupdav_propfind.c b/webcit/groupdav_propfind.c index b3f2d3b81..2780a5909 100644 --- a/webcit/groupdav_propfind.c +++ b/webcit/groupdav_propfind.c @@ -98,7 +98,7 @@ void groupdav_folder_list(void) { serv_gets(buf); if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) { - extract(roomname, buf, 0); + extract_token(roomname, buf, 0, '|', sizeof roomname); view = extract_int(buf, 6); /* diff --git a/webcit/groupdav_put.c b/webcit/groupdav_put.c index c6ced17b6..d634a9aff 100644 --- a/webcit/groupdav_put.c +++ b/webcit/groupdav_put.c @@ -46,7 +46,7 @@ void groupdav_put(char *dav_pathname, char *dav_ifmatch, /* Now extract the message euid */ n = num_tokens(dav_pathname, '/'); - extract_token(dav_uid, dav_pathname, n-1, '/'); + extract_token(dav_uid, dav_pathname, n-1, '/', sizeof dav_uid); remove_token(dav_pathname, n-1, '/'); /* What's left is the room name. Remove trailing slashes. */ diff --git a/webcit/iconbar.c b/webcit/iconbar.c index 373370389..248f2b680 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -59,11 +59,11 @@ void do_iconbar(void) { /* */ - get_preference("iconbar", iconbar); + get_preference("iconbar", iconbar, sizeof iconbar); for (i=0; i 0) { for (i=0; i"); - extract_token(buf, ic_spec[which], i, '\n'); + extract_token(buf, ic_spec[which], i, '\n', sizeof buf); escputs(buf); wprintf("" "\n" serv_gets(buf); if (buf[0] == '1') { while (serv_gets(buf), strcmp(buf, "000")) { - extract(sroom, buf, 0); + extract_token(sroom, buf, 0, '|', sizeof sroom); self = extract_int(buf, 4) & QR2_SELFLIST ; if (self) { wprintf("Address:"); for (j=0; j 0) { escputs(buf); if (j<3) wprintf("
"); @@ -505,10 +505,10 @@ void read_message(long msgnum) { } if (!strncasecmp(buf, "part=", 5)) { - extract(mime_filename, &buf[5], 1); - extract(mime_partnum, &buf[5], 2); - extract(mime_disposition, &buf[5], 3); - extract(mime_content_type, &buf[5], 4); + extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename); + extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum); + extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition); + extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type); mime_length = extract_int(&buf[5], 5); if (!strcasecmp(mime_disposition, "attachment")) { @@ -821,10 +821,10 @@ void display_addressbook(long msgnum, char alpha) { while (serv_gets(buf), strcmp(buf, "000")) { if (!strncasecmp(buf, "part=", 5)) { - extract(mime_filename, &buf[5], 1); - extract(mime_partnum, &buf[5], 2); - extract(mime_disposition, &buf[5], 3); - extract(mime_content_type, &buf[5], 4); + extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename); + extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum); + extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition); + extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type); mime_length = extract_int(&buf[5], 5); if (!strcasecmp(mime_content_type, "text/x-vcard")) { @@ -874,7 +874,7 @@ void lastfirst_firstlast(char *namebuf) { i = num_tokens(namebuf, ' '); if (i < 2) return; - extract_token(lastname, namebuf, i-1, ' '); + extract_token(lastname, namebuf, i-1, ' ', sizeof lastname); remove_token(namebuf, i-1, ' '); strcpy(firstname, namebuf); sprintf(namebuf, "%s; %s", lastname, firstname); @@ -913,10 +913,10 @@ void fetch_ab_name(long msgnum, char *namebuf) { while (serv_gets(buf), strcmp(buf, "000")) { if (!strncasecmp(buf, "part=", 5)) { - extract(mime_filename, &buf[5], 1); - extract(mime_partnum, &buf[5], 2); - extract(mime_disposition, &buf[5], 3); - extract(mime_content_type, &buf[5], 4); + extract_token(mime_filename, &buf[5], 1, '|', sizeof mime_filename); + extract_token(mime_partnum, &buf[5], 2, '|', sizeof mime_partnum); + extract_token(mime_disposition, &buf[5], 3, '|', sizeof mime_disposition); + extract_token(mime_content_type, &buf[5], 4, '|', sizeof mime_content_type); mime_length = extract_int(&buf[5], 5); if (!strcasecmp(mime_content_type, "text/x-vcard")) { @@ -1787,7 +1787,7 @@ void confirm_move_msg(void) serv_gets(buf); if (buf[0] == '1') { while (serv_gets(buf), strcmp(buf, "000")) { - extract(targ, buf, 0); + extract_token(targ, buf, 0, '|', sizeof targ); wprintf("