return MR_ARG_TOO_LONG;
}
+ if (q->version > 10)
+ {
+ /* For both winhomedir and winprofiledir, we allow values of the
+ * following forms:
+ *
+ * [AFS] - Magic token for AFS home directory.
+ * [LOCAL] - Magic token for AD default local values, i.e. C:\<mumble>
+ * [DFS] - Magic token for DFS home directory
+ * UNC pathname - \\<something>
+ * local pathname - <drive letter>:<something>
+ */
+
+ if ((strcasecmp(argv[row + 12], "[AFS]")) &&
+ (strcasecmp(argv[row + 12], "[LOCAL]")) &&
+ (strcasecmp(argv[row + 12], "[DFS]")) &&
+ (!(argv[row + 12][0] == '\\' && argv[row + 12][1] == '\\')) &&
+ (!(isalpha(*argv[row + 12]) && (argv[row + 12][1] == ':'))))
+ return MR_BAD_CHAR;
+
+ if ((strcasecmp(argv[row + 13], "[AFS]")) &&
+ (strcasecmp(argv[row + 13], "[LOCAL]")) &&
+ (strcasecmp(argv[row + 13], "[DFS]")) &&
+ (!(argv[row + 13][0] == '\\' && argv[row + 13][1] == '\\')) &&
+ (!(isalpha(*argv[row + 13]) && (argv[row + 13][1] == ':'))))
+ return MR_BAD_CHAR;
+ }
+
if (!strcmp(argv[row], UNIQUE_UID) || atoi(argv[row]) == -1)
{
if ((err = set_next_object_id("unix_uid", USERS_TABLE, 1)))
if ((mr_errcode = prefetch_value(q, argv, cl)) != MR_SUCCESS)
return mr_errcode;
- /* If this is an UPDATE query, we're done. */
+ /* If this is an MR_Q_UPDATE query, we're done. */
if (row == 2)
return MR_SUCCESS;
WHERE potype = 'POP' AND pop_id = :id;
if (cnt > 0)
return MR_IN_USE;
+ EXEC SQL SELECT COUNT(login) INTO :cnt FROM users
+ WHERE potype = 'EXCHANGE' and exchange_id = :id;
+ if (cnt > 0)
+ return MR_IN_USE;
EXEC SQL SELECT COUNT(mach_id) INTO :cnt FROM serverhosts
WHERE mach_id = :id;
if (cnt > 0)
char *account_number;
/* Check for asnt or usnt. */
- if (q->type == APPEND)
+ if (q->type == MR_Q_APPEND)
row = 0;
else
row = 1;
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
};
+static const char *mailman_suffixes[] = { "-admin", "-owner", "-request",
+ "-bounces", "-confirm", "-join",
+ "-leave", "-subscribe",
+ "-unsubscribe", NULL };
+
int setup_alis(struct query *q, char *argv[], client *cl)
{
EXEC SQL BEGIN DECLARE SECTION;
- int ngid, cnt, mailman, mailman_id;
+ int ngid, cnt, mailman, mailman_id, lid;
char *name, *desc;
EXEC SQL END DECLARE SECTION;
unsigned char *p;
- int idx, err, best = -1, usage;
+ int idx, err, best = -1, usage, i;
if (!strcmp(q->shortname, "alis"))
idx = 0;
if (idx == 1)
{
- EXEC SQL BEGIN DECLARE SECTION;
- int lid = *(int *)argv[0];
- EXEC SQL END DECLARE SECTION;
+ lid = *(int *)argv[0];
if (acl_access_check(lid, cl))
return MR_PERM;
/* Don't let someone rename a list to one of the magic mailman names
* (foo-admin, etc) if foo already exists as a mailman list.
*/
- if ((err = check_mailman_listname(name, "-admin")) != MR_SUCCESS)
- return err;
- if ((err = check_mailman_listname(name, "-owner")) != MR_SUCCESS)
- return err;
- if ((err = check_mailman_listname(name, "-request")) != MR_SUCCESS)
- return err;
+ for (i = 0; mailman_suffixes[i]; i++)
+ {
+ if ((err = check_mailman_listname(name, mailman_suffixes[i]))
+ != MR_SUCCESS)
+ return err;
+ }
if (q->version >= 10)
{
return MR_SERVICE;
}
}
+ else
+ {
+ /* Client too old to know about the mailman code.
+ * Use existing value of mailman boolean in the table.
+ * Don't do this for add_list from an old client, since the row
+ * they're creating won't exist yet, and there's no way for them to
+ * create a list with the mailman bit set, anyway.
+ */
+ if (idx == 1)
+ {
+ EXEC SQL SELECT mailman INTO :mailman FROM list WHERE list_id = :lid;
+ if (mailman)
+ {
+ EXEC SQL SELECT COUNT(name) INTO :cnt FROM list
+ WHERE (name = :name || '-admin' OR name = :name || '-owner' OR
+ name = :name || '-request');
+ if (cnt)
+ return MR_EXISTS;
+ }
+ }
+ }
if ((mr_errcode = prefetch_value(q, argv, cl)) != MR_SUCCESS)
return mr_errcode;
* from within a setup_...() routine with the appropriate arguments.
*
* Correct functioning of this routine may depend on the assumption
- * that this query is an APPEND.
+ * that this query is an MR_Q_APPEND.
*/
int prefetch_value(struct query *q, char **argv, client *cl)
if (sqlca.sqlerrd[2] != 1)
return MR_INTERNAL;
- argc = q->argc + q->vcnt; /* end of Argv for APPENDs */
+ argc = q->argc + q->vcnt; /* end of Argv for MR_Q_APPENDs */
sprintf(argv[argc], "%d", value);
return MR_SUCCESS;
}
+/* setup_ghst():
+ */
+
+int setup_ghst(struct query *q, char **argv, client *cl)
+{
+ if (strcmp(argv[0], "*") || strcmp(argv[1], "*") ||
+ strcmp(argv[2], "*") || strcmp(argv[3], "*"))
+ return MR_SUCCESS;
+ else
+ return MR_PERM;
+}
+
/* setup_ahst():
*/
EXEC SQL END DECLARE SECTION;
/* Check for aprn or uprn. */
- if (q->type == APPEND)
+ if (q->type == MR_Q_APPEND)
row = 0;
else
row = 1;
return MR_BAD_CHAR;
else
{
- if (q->type == APPEND)
+ if (q->type == MR_Q_APPEND)
{
EXEC SQL SELECT COUNT(name) INTO :count FROM printers
WHERE name = :name OR duplexname = :name;
if (*duplexname)
{
- if (q->type == APPEND)
+ if (q->type == MR_Q_APPEND)
{
EXEC SQL SELECT COUNT(name) INTO :count FROM printers
WHERE name = :duplexname OR duplexname = :duplexname;
return 1;
}
+int setup_aali(struct query *q, char *argv[], client *cl)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int cnt;
+ char *name, *type, *trans;
+ EXEC SQL END DECLARE SECTION;
+ name = argv[0];
+ type = argv[1];
+ trans = argv[2];
+
+ if (strcmp(strtrim(type), "FILESYS"))
+ return MR_SUCCESS;
+
+ EXEC SQL SELECT count(label) INTO :cnt FROM filesys WHERE
+ label = :name;
+ if (cnt > 0)
+ return MR_EXISTS;
+
+ return MR_SUCCESS;
+}
+
int setup_acon(struct query *q, char *argv[], client *cl)
{
EXEC SQL BEGIN DECLARE SECTION;