diff options
author | ijliao <ijliao@FreeBSD.org> | 2001-12-13 04:16:22 +0800 |
---|---|---|
committer | ijliao <ijliao@FreeBSD.org> | 2001-12-13 04:16:22 +0800 |
commit | ca4eb5003876f671a22d34f5c2992b412575ca07 (patch) | |
tree | 5c6ce4b92cd91bbaa7be748da1ce231caebd9363 /misc | |
parent | da2c2f35b3d70c5fa63a65e0dc54f48ce4a7b57a (diff) | |
download | freebsd-ports-gnome-ca4eb5003876f671a22d34f5c2992b412575ca07.tar.gz freebsd-ports-gnome-ca4eb5003876f671a22d34f5c2992b412575ca07.tar.zst freebsd-ports-gnome-ca4eb5003876f671a22d34f5c2992b412575ca07.zip |
make it run well with kronolith
PR: 32711
Submitted by: maintainer
Diffstat (limited to 'misc')
-rw-r--r-- | misc/libmcal/Makefile | 24 | ||||
-rw-r--r-- | misc/libmcal/files/patch-ad | 17 | ||||
-rw-r--r-- | misc/libmcal/files/patch-ae | 73 | ||||
-rw-r--r-- | misc/libmcal/files/patch-af | 65 | ||||
-rw-r--r-- | misc/libmcal/files/patch-ag | 120 | ||||
-rw-r--r-- | misc/libmcal/files/patch-ah | 25 | ||||
-rw-r--r-- | misc/libmcal/files/patch-ai | 88 | ||||
-rw-r--r-- | misc/libmcal/files/patch-aj | 184 | ||||
-rw-r--r-- | misc/libmcal/files/patch-ak | 106 | ||||
-rw-r--r-- | misc/libmcal/files/patch-al | 479 | ||||
-rw-r--r-- | misc/libmcal/pkg-message | 16 |
11 files changed, 1180 insertions, 17 deletions
diff --git a/misc/libmcal/Makefile b/misc/libmcal/Makefile index 795c5117c773..54461e1eeeed 100644 --- a/misc/libmcal/Makefile +++ b/misc/libmcal/Makefile @@ -7,6 +7,7 @@ PORTNAME= libmcal PORTVERSION= 0.6 +PORTREVISION= 1 CATEGORIES= misc MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= ${PORTNAME} @@ -34,7 +35,6 @@ post-extract: ${CP} -pR ${WRKSRCDRV}/icap ${WRKSRC} ${MV} ${WRKSRC}/mstore/Makefile ${WRKSRC}/mstore/Makefile.dist ${MV} ${WRKSRC}/mstore/Makefile.FreeBSD ${WRKSRC}/mstore/Makefile - ${PERL} -pi -e "s:/etc/mpasswd:${PREFIX}/etc/mpasswd:" ${WRKSRC}/mstore/mstore.c ${MV} ${WRKSRC}/icap/Makefile ${WRKSRC}/icap/Makefile.dist ${MV} ${WRKSRC}/icap/Makefile.FreeBSD ${WRKSRC}/icap/Makefile ${MV} ${WRKSRC}/configure ${WRKSRC}/configure.dist @@ -42,6 +42,9 @@ post-extract: ${CHMOD} u+x ${WRKSRC}/configure ${MV} ${WRKSRC}/mstore/README ${WRKSRC}/mstore/README.mstore +post-patch: + ${PERL} -pi -e "s:/etc/mpasswd:${PREFIX}/etc/mpasswd:" ${WRKSRC}/mstore/mstore.c + pre-configure: @${ECHO_MSG} "===> Building the driver mstore" cd ${WRKSRC}/mstore ; \ @@ -60,21 +63,8 @@ post-install: .endfor @${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}." .endif - @${ECHO} "*****************************************************************************" - @${ECHO} " libmcap has been installed. In order to end its configuration," - @${ECHO} " please enter the following commands:" - @${ECHO} "" - @${ECHO} " mkdir /var/calendar" - @${ECHO} " chmod 1777 /var/calendar" - @${ECHO} "" - @${ECHO} " To work with the mstore driver, using the Apache's htpasswd utility," - @${ECHO} " you may create the mpasswd file with the command below:" - @${ECHO} "" - @${ECHO} " htpasswd -c ${LOCALBASE}/etc/mpasswd username" - @${ECHO} "" - @${ECHO} " To add or update this file you would execute as follows:" - @${ECHO} "" - @${ECHO} " htpasswd ${LOCALBASE}/etc/mpasswd username" - @${ECHO} "*****************************************************************************" + @${ECHO} + @${CAT} ${PKGMESSAGE} | ${SED} -e "s:%%LOCALBASE%%:${LOCALBASE}:g" + @${ECHO} .include <bsd.port.mk> diff --git a/misc/libmcal/files/patch-ad b/misc/libmcal/files/patch-ad new file mode 100644 index 000000000000..5ece66b2d1e6 --- /dev/null +++ b/misc/libmcal/files/patch-ad @@ -0,0 +1,17 @@ +--- bool.h.orig Thu Dec 2 09:01:39 1999 ++++ bool.h Wed Jun 28 00:17:14 2000 +@@ -1,4 +1,4 @@ +-/* $Id: bool.h,v 1.1.1.1 1999/12/02 08:01:39 zircote Exp $ ++/* $Id: bool.h,v 1.2 2000/06/27 22:17:14 askalski Exp $ + * + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski +@@ -32,7 +32,7 @@ + #ifndef _BOOL_H + #define _BOOL_H + +-#ifndef __cplusplus__ ++#ifndef __cplusplus + typedef enum { false, true } bool; + #endif + diff --git a/misc/libmcal/files/patch-ae b/misc/libmcal/files/patch-ae new file mode 100644 index 000000000000..c9b5de5b647e --- /dev/null +++ b/misc/libmcal/files/patch-ae @@ -0,0 +1,73 @@ +--- datetime.c.orig Sat Mar 11 03:14:42 2000 ++++ datetime.c Thu May 11 21:43:23 2000 +@@ -1,5 +1,5 @@ + /* +- * $Id: datetime.c,v 1.2 2000/03/11 02:14:42 chuck Exp $ ++ * $Id: datetime.c,v 1.3 2000/05/11 19:43:23 inan Exp $ + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski + * +@@ -280,8 +280,37 @@ + { + return dt_dayofepoch(dt) % 7; + } +- +- ++/* ++char* ++dt_dayofweekstr(const datetime_t *dt) ++{ ++ char output[3]; ++ switch (dt_dayofepoch(dt) % 7) { ++ case 0: ++ strcpy (output, "SU"); ++ break; ++ case 1: ++ strcpy (output, "MO"); ++ break; ++ case 2: ++ strcpy (output, "TU"); ++ break; ++ case 3: ++ strcpy (output, "WE"); ++ break; ++ case 4: ++ strcpy (output, "TH"); ++ break; ++ case 5: ++ strcpy (output, "FR"); ++ break; ++ case 6: ++ strcpy (output, "SA"); ++ break; ++ } ++ return output; ++} ++*/ + int + dt_dayofepoch(const datetime_t *dt) + { +@@ -460,3 +489,23 @@ + } + return w; + } ++ ++int ++dt_orderofmonth( const datetime_t *dt, const direction_t direction) ++{ ++ datetime_t temp_dt = DT_INIT; ++ int temp_int; ++ ++ switch (direction) { ++ case DT_FORWARD: ++ dt_setnthwday(&temp_dt, dt->year, dt->mon, 1, dt_dayofweek(dt) ); ++ temp_int = (dt->mday - temp_dt.mday)/7; ++ temp_int ++; //start count at 1, not zero ++ break; ++ case DT_BACKWARD: ++ // not built ++ return false; ++ } ++ return temp_int; ++} ++ diff --git a/misc/libmcal/files/patch-af b/misc/libmcal/files/patch-af new file mode 100644 index 000000000000..6fab309d4a87 --- /dev/null +++ b/misc/libmcal/files/patch-af @@ -0,0 +1,65 @@ +--- datetime.h.orig Sat Mar 11 03:14:43 2000 ++++ datetime.h Fri Mar 16 20:27:14 2001 +@@ -1,5 +1,5 @@ + /* +- * $Id: datetime.h,v 1.2 2000/03/11 02:14:43 chuck Exp $ ++ * $Id: datetime.h,v 1.4 2001/03/16 19:27:14 chuck Exp $ + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski + * +@@ -26,7 +26,7 @@ + * Andrew Skalski + * askalski@chek.com + * +- * mcal@lists.chek.com ++ * libmcal-users@lists.sourceforge.net + */ + + #ifndef _DATETIME_H +@@ -66,6 +66,11 @@ + DECEMBER + } month_t; + ++typedef enum { ++ DT_FORWARD, ++ DT_BACKWARD ++} direction_t; ++ + /** + * struct datetime + * +@@ -178,11 +183,34 @@ + /* Returns the week number for d=day, m=month, y=year */ + int dt_weekofyear(int d, int m, int y); + ++/* Returns the week number in the given month counting in the given direction */ ++int dt_orderofmonth( const datetime_t *dt, const direction_t direction); ++ + /* convenience macros to get the first/last days of a week */ + #define dt_startofweek(dt, ref, weekstart) \ + dt_setweekof((dt), (ref), (weekstart), (weekstart)) + #define dt_endofweek(dt, ref, weekstart) \ + dt_setweekof((dt), (ref), (weekstart), (7+(weekstart)-1)%7) ++#define dt_dayofweekstr(dayno) \ ++ (dayno) >= 4 ? \ ++ (dayno) = 6 ? \ ++ "SA" : \ ++ (dayno) = 5 ? \ ++ "FR" : \ ++ "TH" \ ++ ; \ ++ ;: \ ++ (dayno) >= 2 ? \ ++ (dayno) = 3 ? \ ++ "WE" : \ ++ "TU" \ ++ ;: \ ++ (dayno) = 1 ? \ ++ "MO" : \ ++ "SU" \ ++ ; \ ++ ; \ ++ + + /**********************************/ + diff --git a/misc/libmcal/files/patch-ag b/misc/libmcal/files/patch-ag new file mode 100644 index 000000000000..e3217bded96c --- /dev/null +++ b/misc/libmcal/files/patch-ag @@ -0,0 +1,120 @@ +--- icalroutines.c.orig Tue Jan 25 04:08:10 2000 ++++ icalroutines.c Thu May 11 21:43:23 2000 +@@ -1,5 +1,5 @@ + /* +- * #$Id: icalroutines.c,v 1.1 2000/01/25 03:08:10 markie Exp $ ++ * #$Id: icalroutines.c,v 1.2 2000/05/11 19:43:23 inan Exp $ + * + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski +@@ -594,3 +594,110 @@ + putc(pad, out); + } + } ++ ++#define MAX(a,b) (a)>(b) ? (a) :(b) ++void ++ical_set_byday ( char *output, const byday_t *input ) { ++ int i; ++ char temp_string[50]; ++ ++ strcpy (output, ""); ++ ++ for (i=0; i<=6; i++) { ++ /* wdays is a bit field corresponding to days of the week */ ++ if ((input->weekdays) & (0x1 <<i) ) { ++ if (input->ordwk[i] != 0) { ++ sprintf( temp_string, "%d", input->ordwk[i] ); ++ strcat ( output, temp_string ); ++ } ++ switch (i) { ++ case 0: ++ strcat ( output, "SU, "); ++ break; ++ case 1: ++ strcat ( output, "MO, "); ++ break; ++ case 2: ++ strcat ( output, "TU, "); ++ break; ++ case 3: ++ strcat ( output, "WE, "); ++ break; ++ case 4: ++ strcat ( output, "TH, "); ++ break; ++ case 5: ++ strcat ( output, "FR, "); ++ break; ++ case 6: ++ strcat ( output, "SA, "); ++ break; ++ } ++ } ++ } ++ output[MAX(strlen(output)-2,0)] = '\0'; ++ ++} ++#undef MAX ++ ++void ++ical_get_byday ( byday_t *output, const char *input ) { ++ char *temp_string; ++ char *token; ++ char *day_start; ++ int interval; ++ int day_index; ++ temp_string = strdup(input); ++ ++ token = strtok (temp_string, ","); ++ while ( token != NULL ) { ++ day_start = token + strlen(token) - 2; ++ if (strcasecmp (day_start, "SU")==0) { ++ output->weekdays |= M_SUNDAY; ++ day_index = 0; ++ } else if (strcasecmp (day_start, "MO")==0) { ++ output->weekdays |= M_MONDAY; ++ day_index = 1; ++ } else if (strcasecmp (day_start, "TU")==0) { ++ output->weekdays |= M_TUESDAY; ++ day_index = 2; ++ } else if (strcasecmp (day_start, "WE")==0) { ++ output->weekdays |= M_WEDNESDAY; ++ day_index = 3; ++ } else if (strcasecmp (day_start, "TH")==0) { ++ output->weekdays |= M_THURSDAY; ++ day_index = 4; ++ } else if (strcasecmp (day_start, "FR")==0) { ++ output->weekdays |= M_FRIDAY; ++ day_index = 5; ++ } else if (strcasecmp (day_start, "SA")==0) { ++ output->weekdays |= M_SATURDAY; ++ day_index = 6; ++ } ++ *day_start = '\0'; ++ interval = atoi (token); ++ output->ordwk[day_index] = interval; ++ } ++ ++ free( token ); ++ free( temp_string ); ++} ++ ++void ++ical_get_recur_freq( recur_t *output, const char *input, const char *byday) { ++ if (strncmp (input, "D",1)==0) { ++ *output = RECUR_DAILY; ++ } else if (strncmp (input, "W",1)==0) { ++ *output = RECUR_WEEKLY; ++ } else if (strncmp (input, "M",1)==0) { ++ if (strlen(byday) == 0) { ++ *output = RECUR_MONTHLY_MDAY; ++ } else { ++ *output = RECUR_MONTHLY_WDAY; ++ } ++ } else if (strncmp (input, "Y",1)==0) { ++ *output = RECUR_YEARLY; ++ } else { ++ *output = RECUR_NONE; ++ } ++} diff --git a/misc/libmcal/files/patch-ah b/misc/libmcal/files/patch-ah new file mode 100644 index 000000000000..ef9e8eb686c9 --- /dev/null +++ b/misc/libmcal/files/patch-ah @@ -0,0 +1,25 @@ +--- icalroutines.h.orig Tue Jan 25 04:08:10 2000 ++++ icalroutines.h Thu May 11 21:43:23 2000 +@@ -1,5 +1,5 @@ + /* +- * #$Id: icalroutines.h,v 1.1 2000/01/25 03:08:10 markie Exp $ ++ * #$Id: icalroutines.h,v 1.2 2000/05/11 19:43:23 inan Exp $ + * + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski +@@ -70,5 +70,15 @@ + const unsigned char *buf, + size_t size); + ++/* ICAL formatting. */ ++#define BYDAY_INIT {0, {0,0,0,0,0,0,0}} ++typedef struct { ++ unsigned int weekdays; ++ int ordwk[7]; ++} byday_t; ++ ++void ical_set_byday(char *output, const byday_t *input); ++void ical_get_byday(byday_t *output, const char *input); ++void ical_get_recur_freq( recur_t *output, const char *input, const char *byday); + + #endif diff --git a/misc/libmcal/files/patch-ai b/misc/libmcal/files/patch-ai new file mode 100644 index 000000000000..c1d91d33bdcb --- /dev/null +++ b/misc/libmcal/files/patch-ai @@ -0,0 +1,88 @@ +--- icap/icap.c.orig Mon Mar 27 06:12:33 2000 ++++ icap/icap.c Fri Jul 7 17:16:18 2000 +@@ -2,7 +2,7 @@ + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski + * +- * #$Id: icap.c,v 1.1.1.1 1999/12/02 08:02:27 zircote Exp $ ++ * #$Id: icap.c,v 1.4 2000/07/07 15:16:18 markie Exp $ + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public +@@ -36,7 +36,7 @@ + #include "icaproutines.h" + + +-#define ICAP_VAR "0.3" ++#define ICAP_VAR "0.2" + /** ICAP Driver **/ + #define DATA_T struct icap_data + #define DATA ((DATA_T*) stream->data) +@@ -49,6 +49,7 @@ + const CALADDR *addr, long options); + static CALSTREAM* icap_close(CALSTREAM *stream, long options); + static bool icap_ping(CALSTREAM *stream); ++static bool icap_create(CALSTREAM *stream, const char *calendar); + static bool icap_search_range( CALSTREAM *stream, + const datetime_t *start, + const datetime_t *end); +@@ -72,6 +73,7 @@ + icap_open, + icap_close, + icap_ping, ++ icap_create, + icap_search_range, + icap_search_alarm, + icap_fetch, +@@ -243,6 +245,13 @@ + + + bool ++icap_create(CALSTREAM *stream, const char *calendar) ++{ ++ return false; ++} ++ ++ ++bool + icap_search_range( CALSTREAM *stream, + const datetime_t *start, + const datetime_t *end) +@@ -258,12 +267,12 @@ + + endq = query; + if (start && dt_hasdate(start)) { +- endq += sprintf(endq, " ICAL DTSTART>=%04u%02u%02u", +- start->year, start->mon, start->mday); ++ endq += sprintf(endq, " ICAL DTSTART > %04u%02u%02u", ++ start->year, start->mon, start->mday-1); + } + if (end && dt_hasdate(end)) { +- endq += sprintf(endq, " ICAL DTSTART<=%04u%02u%02u", +- end->year, end->mon, end->mday); ++ endq += sprintf(endq, " ICAL DTSTART < %04u%02u%02u", ++ end->year, end->mon, end->mday+1); + } + if (endq == query) + strcpy(query, " ALL"); +@@ -288,7 +297,7 @@ + if (dt_empty(when)) + return false; + +- sprintf(query, "UID SEARCH ALARMING %04u%02u%02uT%02u%02u%02uZ", ++ sprintf(query, "UID SEARCH COMPONENT VALARM ICAL DTSTART = %04u%02u%02uT%02u%02u%02uZ", + when->year, when->mon, when->mday, + when->hour, when->min, when->sec); + +@@ -373,9 +382,9 @@ + { + char query[1024]; + +- if (!icap_begin(DATA->net, "UID REMOVE ")) ++ if (!icap_begin(DATA->net, "UID STORE ")) + return false; +- sprintf(query, "%lu", id); ++ sprintf(query, "%lu +FLAGS \\Deleted", id); + if (!icap_opaque(DATA->net, query)) + return false; + if (icap_end(DATA->net) != ICAP_OK) diff --git a/misc/libmcal/files/patch-aj b/misc/libmcal/files/patch-aj new file mode 100644 index 000000000000..6831a5b26f88 --- /dev/null +++ b/misc/libmcal/files/patch-aj @@ -0,0 +1,184 @@ +--- mcal.c.orig Sun Feb 27 06:01:54 2000 ++++ mcal.c Tue Jan 9 04:26:48 2001 +@@ -1,5 +1,5 @@ + /* +- * $Id: mcal.c,v 1.6 2000/02/27 05:01:54 inan Exp $ ++ * $Id: mcal.c,v 1.9 2001/01/09 03:26:48 markie Exp $ + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski + * +@@ -174,7 +174,7 @@ + /* size-count and sanity-check all fields */ + if (addr->host) { + /* sanity: host contains neither '/' nor '}' */ +- if (strchr(addr->host, '}') || strchr(addr->host, '/')) ++ if (strpbrk(addr->host, "}/")) + return NULL; + size += strlen(addr->host) + 2; + +@@ -318,10 +318,33 @@ + } + + ++bool ++calevent_valid(const CALEVENT *event) ++{ ++ int n = 0; ++ ++ /* both must have date field set */ ++ if (!dt_hasdate(&event->start) || !dt_hasdate(&event->end)) ++ return false; ++ ++ /* either none or both may have time field set */ ++ if (dt_hastime(&event->start)) n++; ++ if (dt_hastime(&event->end)) n++; ++ if (n == 1) ++ return false; ++ ++ /* start must precede end */ ++ if (dt_compare(&event->start, &event->end) > 0) ++ return false; ++ ++ return true; ++} ++ ++ + const char* +-calevent_getattr(CALEVENT *event, const char *name) ++calevent_getattr(const CALEVENT *event, const char *name) + { +- CALATTR *attr; ++ const CALATTR *attr; + + for (attr = event->attrlist; attr; attr = attr->next) + if (!strcasecmp(attr->name, name)) +@@ -694,7 +717,7 @@ + int wday; + + +- nth = estart.mday / 7 + 1; ++ nth = (estart.mday - 1) / 7 + 1; + wday = dt_dayofweek(&estart); + + /* adjust estart to be the first candidate */ +@@ -750,6 +773,18 @@ + return false; + } + ++bool ++cal_create(CALSTREAM *stream,const char *calendar) { ++ bool output; ++ ++ if (stream == NULL) { ++ output = false; ++ } else { ++ output = stream->driver->create(stream, calendar); ++ } ++ ++ return output; ++} + + bool + cal_valid(const char *address) +@@ -880,6 +915,8 @@ + { + if (stream == NULL || stream->dead) + return false; ++ if (!calevent_valid(event)) ++ return false; + return stream->driver->append(stream, addr, id, event); + } + +@@ -944,12 +981,31 @@ + return good; + } + ++ ++bool ++cal_delete(CALSTREAM *stream, char *calendar) ++{ ++ if (stream == NULL || stream->dead) ++ return false; ++ return stream->driver->delete(stream, calendar); ++} ++ ++bool ++cal_rename(CALSTREAM *stream, char *src,char *dest) ++{ ++ if (stream == NULL || stream->dead) ++ return false; ++ return stream->driver->rename(stream, src,dest); ++} ++ ++ + /** Dummy Driver **/ + static bool dummy_valid(const CALADDR *addr); + static CALSTREAM* dummy_open( CALSTREAM *stream, + const CALADDR *addr, long options); + static CALSTREAM* dummy_close(CALSTREAM *stream, long options); + static bool dummy_ping(CALSTREAM *stream); ++static bool dummy_create(CALSTREAM *stream, const char *calendar); + static bool dummy_search_range( CALSTREAM *stream, + const datetime_t *start, + const datetime_t *end); +@@ -967,18 +1023,28 @@ + static bool dummy_snooze( CALSTREAM *stream, + unsigned long id); + ++static bool dummy_delete( CALSTREAM *stream, ++ char *calendar); ++ ++static bool dummy_rename( CALSTREAM *stream, ++ char *src,char *dest); ++ + const CALDRIVER dummy_driver = + { + dummy_valid, + dummy_open, + dummy_close, + dummy_ping, ++ dummy_create, + dummy_search_range, + dummy_search_alarm, + dummy_fetch, + dummy_append, + dummy_remove, + dummy_snooze, ++ dummy_delete, ++ dummy_rename, ++ + }; + + +@@ -1011,6 +1077,12 @@ + return false; + } + ++bool ++dummy_create(CALSTREAM *stream, const char *calendar) ++{ ++ return false; ++} ++ + + bool + dummy_search_range( CALSTREAM *stream, +@@ -1052,6 +1124,18 @@ + + bool + dummy_snooze(CALSTREAM *stream, unsigned long id) ++{ ++ return false; ++} ++ ++bool ++dummy_delete(CALSTREAM *stream, char *calendar) ++{ ++ return false; ++} ++ ++bool ++dummy_rename(CALSTREAM *stream, char *src,char *dest) + { + return false; + } diff --git a/misc/libmcal/files/patch-ak b/misc/libmcal/files/patch-ak new file mode 100644 index 000000000000..5c84c5ada01d --- /dev/null +++ b/misc/libmcal/files/patch-ak @@ -0,0 +1,106 @@ +--- mcal.h.orig Mon Mar 27 06:00:33 2000 ++++ mcal.h Tue Jan 9 04:26:48 2001 +@@ -1,5 +1,6 @@ ++ + /* +- * $Id: mcal.h,v 1.6 2000/03/27 04:00:33 zircote Exp $ ++ * $Id: mcal.h,v 1.10 2001/01/09 03:26:48 markie Exp $ + * Libmcal - Modular Calendar Access Library + * Copyright (C) 1999 Mark Musone and Andrew Skalski + * +@@ -142,6 +143,15 @@ + size_t bufsize; /* buffer size */ + }; + ++/* calendar stream struct */ ++CALSTREAM { ++ const CALDRIVER *driver; /* stream driver */ ++ CALADDR *addr; /* folder address */ ++ bool dead; /* dead stream? */ ++ weekday_t startofweek; /* first day of week */ ++ void *data; /* driver-specific data */ ++}; ++ + + /* calendar driver structure */ + CALDRIVER { +@@ -169,7 +179,11 @@ + + /* return true if the stream is still alive */ + bool (*ping)( CALSTREAM *stream); +- ++ ++ /* return true if calendar created ok */ ++ bool (*create)( CALSTREAM *stream, ++ const char *calendar); ++ + /* search the current folder for events between <start> and + * <end> (inclusive.) if either lacks a date or is NULL, that + * bound will not be checked. if both lack a date or are NULL, +@@ -222,20 +236,17 @@ + bool (*store)( CALSTREAM *stream, + const CALEVENT *event); + ++ /* Delete an entire calendar */ ++ bool (*delete)( CALSTREAM *stream, char *calendar); + +-}; ++ bool (*rename)( CALSTREAM *stream,char *src,char *dest); + + +-/* calendar stream struct */ +-CALSTREAM { +- const CALDRIVER *driver; /* stream driver */ +- CALADDR *addr; /* folder address */ +- bool dead; /* dead stream? */ +- weekday_t startofweek; /* first day of week */ +- void *data; /* driver-specific data */ + }; + + ++ ++ + /** calendar client callbacks **/ + + /* Called when a stream driver requires a username/password. It is +@@ -287,8 +298,11 @@ + /* Disposes of a CALEVENT, returns NULL for convenience. */ + CALEVENT* calevent_free(CALEVENT *event); + ++/* Check the validity of an event's fields. */ ++bool calevent_valid(const CALEVENT *event); ++ + /* Routines to set and fetch event attributes. */ +-const char* calevent_getattr(CALEVENT *event, const char *name); ++const char* calevent_getattr(const CALEVENT *event, const char *name); + bool calevent_setattr(CALEVENT *event, const char *name, + const char *value); + +@@ -322,7 +336,10 @@ + */ + bool first_day_not_before( int mask, weekday_t *clamp, + weekday_t weekstart); +- ++/* Creates a new calendar ++ */ ++bool cal_create(CALSTREAM *stream,const char *calendar); ++ + /* Returns true if the address is valid for any of the calendar drivers */ + bool cal_valid(const char *address); + +@@ -400,6 +417,15 @@ + /* Cancels the alarm for event with id of <id>. Returns false on error. */ + bool cal_snooze( CALSTREAM *stream, + unsigned long id); ++ ++/* delete an entire calendar */ ++ ++bool cal_delete( CALSTREAM *stream, ++ char *calendar); ++ ++/* rename a calendar */ ++bool cal_rename( CALSTREAM *stream, ++ char *src,char *dest); + + + /* private functions */ diff --git a/misc/libmcal/files/patch-al b/misc/libmcal/files/patch-al new file mode 100644 index 000000000000..9f0e4019b1ff --- /dev/null +++ b/misc/libmcal/files/patch-al @@ -0,0 +1,479 @@ +--- mstore/mstore.c.orig Mon Mar 27 06:07:12 2000 ++++ mstore/mstore.c Tue Dec 11 08:56:58 2001 +@@ -1,4 +1,4 @@ +-/* $Id: mstore.c,v 1.11 2000/03/27 04:07:12 zircote Exp $ */ ++/* $Id: mstore.c,v 1.21 2001/05/07 17:37:10 chuck Exp $ */ + + #include <stdlib.h> + #include <string.h> +@@ -6,26 +6,33 @@ + #include <pwd.h> + #include <unistd.h> + #include <crypt.h> ++ ++#ifdef USE_PAM ++#include <security/pam_appl.h> ++#endif /* USE_PAM */ ++ + #include "mcal.h" + #include "mstore.h" + #include "icap/icaproutines.h" + +- + #define MSTORE_VER "0.5" + #define DATA_T struct mstore_data + #define DATA ((DATA_T*) stream->data) + +- ++/* mpasswd path define */ ++#ifndef MPASSWD_PATH ++#define MPASSWD_PATH "/etc/mpasswd" ++#endif + + static void mstore_freestream(CALSTREAM *stream); + static bool mstore_validuser(const char *username,const char *password); +-static bool mstore_userexists(const char *username); + + static bool mstore_valid(const CALADDR *addr); + static CALSTREAM* mstore_open( CALSTREAM *stream, + const CALADDR *addr, long options); + static CALSTREAM* mstore_close(CALSTREAM *stream, long options); + static bool mstore_ping(CALSTREAM *stream); ++static bool mstore_create (CALSTREAM *stream, const char *calendar); + static bool mstore_search_range( CALSTREAM *stream, + const datetime_t *start, + const datetime_t *end); +@@ -44,12 +51,18 @@ + unsigned long id); + static bool mstore_store( CALSTREAM *stream, + const CALEVENT *modified_event); ++static bool mstore_delete( CALSTREAM *stream, ++ char *calendar); ++static bool mstore_rename( CALSTREAM *stream, ++ char *src,char *dest); ++ + CALDRIVER mstore_driver = + { + mstore_valid, + mstore_open, + mstore_close, + mstore_ping, ++ mstore_create, + mstore_search_range, + mstore_search_alarm, + mstore_fetch, +@@ -57,6 +70,8 @@ + mstore_remove, + mstore_snooze, + mstore_store, ++ mstore_delete, ++ mstore_rename + }; + + +@@ -88,13 +103,98 @@ + } + + ++#ifdef USE_PAM ++ ++/* PAM support stuff goes here */ ++ ++static pam_handle_t *pamh = NULL; ++static char *PAM_username; ++static char *PAM_password; ++ ++#define COPY_STRING(s) (s) ? strdup(s) : NULL ++ ++static int PAM_conv (int num_msg, ++ const struct pam_message **msg, ++ struct pam_response **resp, ++ void *appdata_ptr) ++{ ++ struct pam_response *reply; ++ int count; ++ ++ if (num_msg < 1) ++ return PAM_CONV_ERR; ++ ++ reply = (struct pam_response *) ++ calloc (num_msg, sizeof(struct pam_response)); ++ ++ if (!reply) ++ return PAM_CONV_ERR; ++ ++ for (count=0; count<num_msg; count++) { ++ char *string = NULL; ++ ++ switch (msg[count]->msg_style) { ++ case PAM_PROMPT_ECHO_ON: ++ if (!(string = COPY_STRING(PAM_username))) ++ goto pam_fail_conv; ++ break; ++ case PAM_PROMPT_ECHO_OFF: ++ if (!(string = COPY_STRING(PAM_password))) ++ goto pam_fail_conv; ++ break; ++ case PAM_TEXT_INFO: ++#ifdef PAM_BINARY_PROMPT ++ case PAM_BINARY_PROMPT: ++#endif /* PAM_BINARY_PROMPT */ ++ /* ignore it */ ++ break; ++ case PAM_ERROR_MSG: ++ default: ++ goto pam_fail_conv; ++ } /* end switch msg[count]->msg_style */ ++ ++ if (string) { ++ reply[count].resp_retcode = 0; ++ reply[count].resp = string; ++ string = NULL; ++ } /* end if string */ ++ ++ } // end for count ++ ++ *resp = reply; ++ return PAM_SUCCESS; ++ ++pam_fail_conv: ++ for(count=0; count<num_msg; count++) { ++ if (!reply[count].resp) ++ continue; ++ switch (msg[count]->msg_style) { ++ case PAM_PROMPT_ECHO_ON: ++ case PAM_PROMPT_ECHO_OFF: ++ free(reply[count].resp); ++ break; ++ } /* end switch msg[count]->msg_style */ ++ } /* end for count */ ++ ++ free(reply); ++ return PAM_CONV_ERR; ++} /* end function static int PAM_conv (...) */ ++ ++static struct pam_conv PAM_conversation = { ++ &PAM_conv, ++ NULL ++}; ++ ++#endif /* USE_PAM */ ++ + bool + mstore_validuser(const char *username,const char *password) + { ++#ifndef USE_PAM + FILE *mpasswd; + char line[1000]; + char *musername,*mpassword; +- mpasswd=fopen("/etc/mpasswd","r"); ++ mpasswd=fopen(MPASSWD_PATH,"r"); + if(!mpasswd) + { + printf("Error! couldn't open mpasswd file!\n"); +@@ -123,36 +223,31 @@ + } + fclose(mpasswd); + return false; +-} +- +- +-bool +-mstore_userexists(const char *username) +-{ +- FILE *mpasswd; +- char line[1000]; +- char *musername,*mpassword; +- mpasswd=fopen("/etc/mpasswd","r"); +- if(!mpasswd) +- { +- printf("Error! couldn't open mpasswd file!\n"); +- exit(1); +- } +- while(fgets(line,900,mpasswd)) +- { +- if(line[strlen(line)-1]=='\n') line[strlen(line)-1]=0x00; +- musername=line; +- mpassword=strchr(line,':'); +- *mpassword=0x00; +- mpassword++; +- if(!strcmp(username,musername)) +- { +- fclose(mpasswd); +- return true; +- } +- } +- fclose(mpasswd); +- return false; ++#else ++ /* PAM authentication */ ++ int PAM_error; ++ ++ PAM_error = pam_start("mstore", username, &PAM_conversation, &pamh); ++ if (PAM_error != PAM_SUCCESS) ++ goto login_err; ++ pam_set_item(pamh, PAM_TTY, "mstore"); ++ pam_set_item(pamh, PAM_RHOST, "localhost"); ++ PAM_error = pam_authenticate(pamh, 0); ++ if (PAM_error != PAM_SUCCESS) ++ if (PAM_error == PAM_MAXTRIES) ++ goto login_err; ++#ifndef PAM_CRED_ESTABLISH ++#define PAM_CRED_ESTABLISH PAM_ESTABLISH_CRED ++#endif /* PAM_CRED_ESTABLISH */ ++ PAM_error = pam_setcred(pamh, PAM_CRED_ESTABLISH); ++ if (PAM_error != PAM_SUCCESS) ++ goto login_err; ++ ++login_err: ++ pam_end(pamh, PAM_error); ++ pamh = NULL; ++ return false; ++#endif /* ! USE_PAM */ + } + + +@@ -161,8 +256,6 @@ + { + if (!addr->proto || strcasecmp(addr->proto, "mstore")) + return false; +- if (addr->user && !mstore_userexists(addr->user)) +- return false; + return true; + } + +@@ -197,10 +290,18 @@ + } + + cc_login(&username, &password); +- if (username == NULL) ++ if (username == NULL) { ++ #ifdef DEBUG ++ printf("\nNULL username\n"); ++ #endif + goto fail; +- if (!mstore_validuser(username,password)) ++ } ++ if (!mstore_validuser(username,password)) { ++ #ifdef DEBUG ++ printf("\n!mstore_validuser(%s,%s)\n",username,password); ++ #endif + goto fail; ++ } + } + + if (!reopen) { +@@ -212,13 +313,23 @@ + + if (options & CAL_LOGIN) { + /* Copy login_userbuf, folder. */ +- if ((DATA->login_userbuf = strdup(username)) == NULL) ++ if ((DATA->login_userbuf = strdup(username)) == NULL) { ++ #ifdef DEBUG ++ printf("\ncouldn't get login_userbuf (%s)\n", ++ username); ++ #endif + goto fail; ++ } + + } + +- if ((DATA->folder = strdup(addr->folder)) == NULL) ++ if ((DATA->folder = strdup(addr->folder)) == NULL) { ++ #ifdef DEBUG ++ printf("\ncouldn't get folder (%s)\n", ++ addr->folder); ++ #endif + goto fail; ++ } + + /* Set up folder_user */ + if(addr->host) +@@ -229,8 +340,13 @@ + DATA->login_user=DATA->login_userbuf; + if (addr->user) { + /* Copy and split folder_userbuf */ +- if ((DATA->folder_userbuf = strdup(addr->user)) == NULL) ++ if ((DATA->folder_userbuf = strdup(addr->user)) == NULL) { ++#ifdef DEBUG ++ printf("\ncouldn't get folder_userbuf (%s)\n", ++ addr->user); ++#endif + goto fail; ++ } + /* Check for identical folder/login users. */ + DATA->folder_user=DATA->folder_userbuf; + if ( !strcmp(DATA->login_user, DATA->folder_user)) +@@ -246,7 +362,6 @@ + DATA->folder_user = DATA->login_user; + } + +- + return stream; + fail: + mstore_freestream(stream); +@@ -270,6 +385,36 @@ + } + + ++bool ++mstore_create(CALSTREAM *stream, const char *calendar) ++{ ++ FILE *calfile; ++ char userpath[1000]; ++ ++ /* ++ if (!(stream = mstore_open (stream, (const CALADDR *)calendar, 0))) { ++ #ifdef DEBUG ++ printf("Error! couldn't open calendar stream!\n"); ++ #endif ++ return false; ++ } ++ */ ++ snprintf(userpath, 900, "%s/%s", DATA->base_path, calendar); ++ #ifdef DEBUG ++ printf("attempting fopen on calendar file '%s'\n", userpath); ++ #endif ++ calfile = fopen (userpath, "w"); ++ if (!calfile) { ++ #ifdef DEBUG ++ printf("Error! couldn't create calendar file!\n"); ++ #endif ++ return false; ++ } ++ fclose (calfile); ++ return true; ++} ++ ++ + CALEVENT *read_event(FILE *calfile) + { + char line[100]; +@@ -277,7 +422,8 @@ + int size; + CALEVENT *event; + +- fgets(line, sizeof(line), calfile); ++ if (fgets(line, sizeof(line), calfile) == NULL) ++ return NULL; + if (sscanf(line, "%d", &size) != 1) + return NULL; + buf = malloc(size + 2); +@@ -334,17 +480,18 @@ + datetime_t _end = DT_INIT; + FILE *calfile; + char userpath[1000]; +- snprintf(userpath,900,"%s/%s",DATA->base_path,DATA->folder_user); +- calfile=fopen (userpath,"a+"); +- if(!calfile) +- { ++ ++ snprintf(userpath, 900, "%s/%s", DATA->base_path, DATA->folder_user); ++ calfile = fopen (userpath, "a+"); ++ if(!calfile) { + printf("Error! couldn't open calendar file!\n"); + exit(1); +- } ++ } + rewind(calfile); + + if (start) { + if (!dt_hasdate(start)) ++//LM:should this be _start = NULL? and again below for end? + start = NULL; + else { + dt_setdate(&_start, +@@ -358,7 +505,7 @@ + dt_setdate(&_end, end->year, end->mon, end->mday); + } + +- while((event=read_event(calfile))) { ++ while((event = read_event(calfile))) { + datetime_t clamp = DT_INIT; + + if (!start) +@@ -385,28 +532,24 @@ + bool + mstore_search_alarm(CALSTREAM *stream, const datetime_t *when) + { +- datetime_t start; +- datetime_t end; +- long alarm = 0; +- unsigned long id = 0; + CALEVENT *event; + FILE *calfile; + char userpath[1000]; + +- snprintf(userpath,900,"%s/%s",DATA->base_path,DATA->folder_user); +- calfile=fopen (userpath,"a+"); +- if(!calfile) +- { ++ snprintf(userpath, 900, "%s/%s", DATA->base_path, DATA->folder_user); ++ calfile=fopen (userpath, "a+"); ++ if(!calfile) { + printf("Error! couldn't open calendar file!\n"); + exit(1); +- } ++ } + rewind(calfile); +- while((event=read_event(calfile))) { +- if (dt_roll_time(&(event->start), 0, -alarm, 0) && +- dt_compare(&(event->start),&start)<=0 && +- dt_compare(&end,&(event->end)) <=0) ++ while ((event = read_event(calfile))) { ++ if (event->alarm && ++ dt_roll_time(&(event->start), 0, -(event->alarm), 0) && ++ dt_compare(&(event->start), when) <= 0 && ++ dt_compare(when, &(event->end)) <=0) + { +- cc_searched(id); ++ cc_searched(event->id); + } + calevent_free(event); + } +@@ -422,13 +565,12 @@ + FILE *calfile; + char userpath[1000]; + +- snprintf(userpath,900,"%s/%s",DATA->base_path,DATA->folder_user); +- calfile=fopen (userpath,"a+"); +- if(!calfile) +- { ++ snprintf(userpath, 900, "%s/%s", DATA->base_path, DATA->folder_user); ++ calfile = fopen (userpath,"a+"); ++ if(!calfile) { + printf("Error! couldn't open calendar file!\n"); + exit(1); +- } ++ } + rewind(calfile); + while((event=read_event(calfile))) { + if(event->id==id) { +@@ -459,8 +601,11 @@ + if (strcasecmp(addr->folder, "INBOX")) + return false; + ++ /* comment this out so that we can share calendars + if (DATA->folder_userbuf) + return false; ++ */ ++ + if (!dt_hasdate(&event->start)) + return false; + +@@ -609,3 +754,15 @@ + return true; + } + ++ ++bool ++mstore_delete(CALSTREAM *stream, char *calendar) ++{ ++ return true; ++} ++ ++bool ++mstore_rename(CALSTREAM *stream, char *src,char *dest) ++{ ++ return true; ++} diff --git a/misc/libmcal/pkg-message b/misc/libmcal/pkg-message new file mode 100644 index 000000000000..8445baa8ee6b --- /dev/null +++ b/misc/libmcal/pkg-message @@ -0,0 +1,16 @@ +***************************************************************************** + libmcal has been installed. In order to end its configuration, + please enter the following commands: + + mkdir /var/calendar + chmod 1777 /var/calendar + + To work with the mstore driver, using the Apache's htpasswd utility, + you may create the mpasswd file with the command below: + + htpasswd -c %%LOCALBASE%%/etc/mpasswd username + + To add or update this file you would execute as follows: + + htpasswd %%LOCALBASE%%/etc/mpasswd username +***************************************************************************** |