Pegasus Mail Extended Features Copyright (c) 1990-94, David Harris, all rights reserved. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ When running on a NetWare LAN, Pegasus Mail can use a set of what are known as "extended features", including autoforwarding for both local and Internet mail and a number of flags. The information is created using either the PCONFIG or PMGRANT programs and is stored in a publicly- readable property in the NetWare bindery, called MAIL_OPTIONS. The reason the property needs to be publicly readable, and also the reason why the features are only available in the NetWare environment, is because most of the features provided this way are actually implemented by other programs, or other users' copies of Pegasus Mail. As an example of this, autoforwarding clearly cannot be done by the user's own account, since this presumes some kind of background processing which is simply not possible under DOS. Instead, when Mercury or Pegasus Mail delivers mail to a user whose account is autoforwarded, it is actually the delivering program which does the autoforwarding, by reading the property and acting on the information it contains. Because properties can only be created in the NetWare bindery by users with SUPERVISOR equivalence, it is not possible to default Pegasus Mail's extended features on - they must be explicitly granted by a privileged user. By changing the access control flags for the property, the privileged user can either allow the user to alter his own extended features, or prevent him from doing so. This capability is provided in the -w flag in PMGRANT. Reading the extended properties ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ In order to read Pegasus Mail's extended properties, you must use the NetWare Client SDK and a supported C compiler. The properties are stored in a rather complex but extensible "tagged" format which allows future extensions to the property list to be added and minimizes to the greatest extent possible the impact of the property on the size of the bindery. Internally, Pegasus Mail represents the information contained in the extended features property in a simple C struct, called a PMPROP. The struct is defined as follows. typedef struct { char auto_forward [60]; // Local autoforwarding address char gw_auto_forward [60]; // Internet autoforward address char from_alias [60]; // Address synonym for this user unsigned flags; // See below char security; } PMPROP; The flags field is a bitmap consisting of the following possible values: #define NO_NOTIFY 2 // If set, no notification messages #define NO_MAIL 4 // If set, no mail delivery at all #define NO_REQ_CON 8 // If set, will not honour read receipts #define AF_DELIVER 16 // If set, deliver autoforwarded mail The following C fragment will read and parse the bindery property into a PMPROP structure when you call read_pmprop (). ------------------ Cut here ----------------------------------------- // PMPROP.C // Read a Pegasus Mail extended feature property from the // NetWare Bindery. // // Copyright (c) 1993, David Harris, all rights reserved. // Permission is granted to use this code without restriction, // except that by using it, you agree to hold the author blameless // for all consequences of its use. No warranty is provided with // this code, either of performance, or for fitness for any purpose. // // No guarantee is offered that this code will remain valid in // future releases of Pegasus Mail. #include #include #include #include #include #define MAXPROP 8192 /* Maximum size of MAIL_OPTIONS property */ char mpropname [] = "MAIL_OPTIONS"; typedef struct { unsigned char ftype, flen; char data []; } TAG; typedef struct { char auto_forward [60]; // Local autoforwarding address char gw_auto_forward [60]; // Internet autoforward address char from_alias [60]; // Address synonym for this user unsigned flags; // See below char security; } PMPROP; #define NO_NOTIFY 2 // If set, no notification messages #define NO_MAIL 4 // If set, no mail delivery at all #define NO_REQ_CON 8 // If set, will not honour read receipts #define AF_DELIVER 16 // If set, deliver autoforwarded mail enum {TAG_END, TAG_AF1, TAG_AF2, TAG_FLAGS, TAG_FROM}; char *get_pmproperty (PMPROP *p, char *userid) { BYTE *segment, *s; long p_seq; char p_name [16]; NWFLAGS p_prop, p_flag; int i; p_seq = -1L; if (NWScanProperty (prefcon, userid, OT_USER, mpropname, (NWOBJ_ID *) &p_seq, p_name, &p_flag, &(p->security), &p_prop, &p_flag) == 0) { if (p_prop == 0) return NULL; if ((segment = (BYTE *) malloc (MAXPROP)) == NULL) return NULL; memset (segment, 0, MAXPROP); s = segment; for (i = 1; p_prop && (i < MAXPROP / 128); i ++) { NWReadPropertyValue (prefcon, userid, OT_USER, mpropname, i, s, &p_prop, &p_flag); s += 128; } return segment; } return NULL; } void read_pmprop (char *userid, PMPROP *p) { char *segment, *s; memset (p, 0, sizeof (PMPROP)); if (standalone) return; if ((segment = get_pmproperty (p, userid)) != NULL) { s = segment; while (((TAG *) s)->ftype != TAG_END) { switch (((TAG *) s)->ftype) { case TAG_AF1 : strncpy (p->auto_forward, ((TAG *) s)->data, sizeof (p->auto_forward) - 1); break; case TAG_AF2 : strncpy (p->gw_auto_forward, ((TAG *) s)->data, sizeof (p->gw_auto_forward) - 1); break; case TAG_FLAGS : p->flags = * ((int *) (((TAG *) s)->data)); break; case TAG_FROM : strncpy (p->from_alias, ((TAG *) s)->data, sizeof (p->from_alias) - 1); } s += ((TAG *) s)->flen; } free (segment); } } ------------------ Cut here ----------------------------------------- Note that code is NOT provided to write an extended features property into the NetWare Bindery. This option is strongly discouraged and will result in suspension of all support from the author for the affected system if attempted. If you have compelling reasons to write directly into this structure which cannot be fulfilled using PMGRANT, contact the author of Pegasus Mail for advice and code support. Your reasons will have to be compelling, though.