+ if (GetValueFromUser("Machine's vendor", &info[M_VENDOR]) == SUB_ERROR)
+ return NULL;
+ if (GetValueFromUser("Machine's model", &info[M_MODEL]) == SUB_ERROR)
+ return NULL;
+ if (GetValueFromUser("Machine's operating system", &info[M_OS]) ==
+ SUB_ERROR)
+ return NULL;
+ if (GetValueFromUser("Machine's location", &info[M_LOC]) == SUB_ERROR)
+ return NULL;
+ if (GetValueFromUser("Machine's contact", &info[M_CONTACT]) ==
+ SUB_ERROR)
+ return NULL;
+ while (1)
+ {
+ int i;
+ if (GetValueFromUser("Machine's status (? for help)",
+ &info[M_STAT]) == SUB_ERROR)
+ return NULL;
+ if (isdigit(info[M_STAT][0]))
+ break;
+ Put_message("Valid status numbers:");
+ for (i = 0; i < 4; i++)
+ Put_message(states[i]);
+ }
+
+ /* there appears to be some argument mismatch between the client
+ * and the server.. so here is this argument shuffler.
+ * I have since modified this to always shuffle the arguments..
+ * not just do so when performing a modify all fields request.
+ * The SetMachinedefaults() has been changed to reflect this.
+ * pray for us and may we attain enlightenment through structures.
+ */
+
+ if (name)
+ {
+ /* info did not come from SetMachineDefaults(), which does not
+ * initialize entry 8 (M_STAT_CHNG), therefore we can
+ * free it.
+ */
+ /* This is an update of an existing machine and the structure
+ * was filled in thru a query to the db which does fill in this
+ * field.
+ */
+ free(info[8]);
+ }
+
+ info[8] = info[M_SUBNET];
+ info[9] = info[M_ADDR];
+ info[10] = info[M_OWNER_TYPE];
+ info[11] = info[M_OWNER_NAME];
+ info[12] = info[M_ACOMMENT];
+ info[13] = info[M_OCOMMENT];
+
+ if (name)
+ {
+ if (GetValueFromUser("Machine's network (or 'none')", &info[8])
+ == SUB_ERROR)
+ return NULL;
+ }
+ if (GetValueFromUser("Machine's address (or 'unassigned' or 'unique')",
+ &info[9]) == SUB_ERROR)
+ return NULL;
+ if (GetTypeFromUser("Machine's owner type", "ace_type", &info[10]) ==
+ SUB_ERROR)
+ return NULL;
+ if (strcmp(info[10], "NONE") &&
+ GetValueFromUser("Owner's Name", &info[11]) == SUB_ERROR)
+ return NULL;
+ if (GetValueFromUser("Administrative comment", &info[12]) == SUB_ERROR)
+ return NULL;
+ if (GetValueFromUser("Operational comment", &info[13]) == SUB_ERROR)
+ return NULL;
+ info[14] = NULL;
+ FreeAndClear(&info[15], TRUE);
+ FreeAndClear(&info[16], TRUE);
+ break;
+ case SUBNET:
+ if (GetValueFromUser("Network description", &info[SN_DESC]) == SUB_ERROR)
+ return NULL;
+ if (GetAddressFromUser("Network address", &info[SN_ADDRESS]) == SUB_ERROR)
+ return NULL;
+ if (GetAddressFromUser("Network mask", &info[SN_MASK]) == SUB_ERROR)
+ return NULL;
+ if (atoi(info[SN_LOW]) == ntohl(inet_addr(S_DEFAULT_LOW)))
+ {
+ struct in_addr low;
+ unsigned long mask, addr;
+
+ addr = atoi(info[SN_ADDRESS]);
+ mask = atoi(info[SN_MASK]);
+ low.s_addr = atoi(info[SN_LOW]);
+ low.s_addr = (low.s_addr & ~mask) | (addr & mask);
+ free(info[SN_LOW]);
+ sprintf(temp_buf, "%d", low.s_addr);
+ info[SN_LOW] = strsave(temp_buf);
+ }
+ if (GetAddressFromUser("Lowest assignable address", &info[SN_LOW]) ==
+ SUB_ERROR)
+ return NULL;
+ if (atoi(info[SN_HIGH]) == ntohl(inet_addr(S_DEFAULT_HIGH)))
+ {
+ struct in_addr high;
+ unsigned long mask, addr;
+
+ addr = atoi(info[SN_ADDRESS]);
+ mask = atoi(info[SN_MASK]);
+ high.s_addr = atoi(info[SN_HIGH]);
+ high.s_addr = (high.s_addr & ~mask) | (addr & mask);
+ free(info[SN_HIGH]);
+ sprintf(temp_buf, "%d", high.s_addr);
+ info[SN_HIGH] = strsave(temp_buf);
+ }
+ if (GetAddressFromUser("Highest assignable address", &info[SN_HIGH]) ==
+ SUB_ERROR)
+ return NULL;
+ if (GetValueFromUser("Hostname prefix", &info[SN_PREFIX]) == SUB_ERROR)
+ return NULL;
+ if (GetTypeFromUser("Owner type", "ace_type", &info[SN_ACE_TYPE]) ==
+ SUB_ERROR)
+ return NULL;
+ if (strcmp(info[SN_ACE_TYPE], "NONE") &&
+ GetValueFromUser("Owner name", &info[SN_ACE_NAME]) == SUB_ERROR)
+ return NULL;
+ FreeAndClear(&info[SN_MODTIME], TRUE);
+ FreeAndClear(&info[SN_MODBY], TRUE);
+ FreeAndClear(&info[SN_MODWITH], TRUE);
+ break;