int mid, sid, id;
char mtype[MACHINE_OWNER_TYPE_SIZE], stype[SUBNET_OWNER_TYPE_SIZE];
EXEC SQL END DECLARE SECTION;
- int status;
+ int status, idx;
+
+ if (q->version < 6)
+ idx = 0;
+ else
+ idx = 1;
if (q->type == RETRIEVE)
{
if (q->type == APPEND)
{
/* Non-query owner must set use to zero */
- if (atoi(argv[6]) != 0)
+ if (atoi(argv[6 + idx]) != 0)
return MR_PERM;
/* ... and start the hostname with a letter */
if (isdigit(argv[0][0]))
return MR_BAD_CHAR;
- id = *(int *)argv[8];
+ id = *(int *)argv[8 + idx];
EXEC SQL SELECT s.owner_type, s.owner_id
INTO :stype, :sid FROM subnet s
WHERE s.snet_id = :id;
int status, acomment, use, ocomment, snid;
char contact[MACHINE_CONTACT_SIZE], address[MACHINE_ADDRESS_SIZE];
char name[MACHINE_NAME_SIZE];
+ char billing_contact[MACHINE_BILLING_CONTACT_SIZE];
EXEC SQL END DECLARE SECTION;
id = *(int *)argv[0];
- EXEC SQL SELECT m.name, m.use, m.contact, m.status, m.address,
- m.owner_type, m.owner_id, m.acomment, m.ocomment, m.snet_id,
- s.owner_type, s.owner_id INTO :name, :use, :contact, :status,
- :address, :mtype, :mid, :acomment, :ocomment, :snid, :stype, :sid
+ EXEC SQL SELECT m.name, m.use, m.contact, m.billing_contact, m.status,
+ m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, m.snet_id,
+ s.owner_type, s.owner_id INTO :name, :use, :contact, :billing_contact,
+ :status, :address, :mtype, :mid, :acomment, :ocomment, :snid, :stype,
+ :sid
FROM machine m, subnet s
WHERE m.mach_id = :id AND s.snet_id = m.snet_id;
if (dbms_errno)
return mr_errcode;
/* non-query-owner cannot change use or ocomment */
- if ((use != atoi(argv[7])) || (ocomment != *(int *)argv[14]))
+ if ((use != atoi(argv[7 + idx])) || (ocomment != *(int *)argv[14 + idx]))
return MR_PERM;
/* or rename to start with digit */
{
/* host owner also cannot change contact, status, address,
owner, or acomment */
- if (strcmp(argv[6], strtrim(contact)) ||
- (status != atoi(argv[8])) ||
- strcmp(argv[10], strtrim(address)) ||
- strcmp(argv[11], strtrim(mtype)) ||
- (mid != *(int *)argv[12]) || (acomment != *(int *)argv[13]))
+ if (strcmp(argv[6 + idx], strtrim(contact)) ||
+ (status != atoi(argv[8 + idx])) ||
+ strcmp(argv[10 + idx], strtrim(address)) ||
+ strcmp(argv[11 + idx], strtrim(mtype)) ||
+ (mid != *(int *)argv[12 + idx]) ||
+ (acomment != *(int *)argv[13 + idx]))
return MR_PERM;
+ /* Billing contact field didn't appear until version 6 */
+ if (q->version >= 6)
+ if (strcmp(argv[8], strtrim(billing_contact)))
+ return MR_PERM;
}
else
return MR_PERM;
}
/* If moving to a new subnet, make sure user is on acl there */
- id = *(int *)argv[9];
+ id = *(int *)argv[9 + idx];
if (id != snid)
{
EXEC SQL SELECT owner_type, owner_id INTO :stype, :sid