From d16a0628af00dc6231a0fea31a33bd254faa3779 Mon Sep 17 00:00:00 2001 From: zacheiss Date: Wed, 2 May 2001 21:44:12 +0000 Subject: [PATCH] Trim whitespace from childname, so we can update a container that contains subcontainers. Don't allow a machine to be assigned to more than one container. --- server/qsupport.pc | 3 ++- server/queries2.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/server/qsupport.pc b/server/qsupport.pc index c6bbe15f..aa041cae 100644 --- a/server/qsupport.pc +++ b/server/qsupport.pc @@ -1923,7 +1923,8 @@ int update_container(struct query *q, char *argv[], client *cl) EXEC SQL FETCH csr_ucon INTO :childname, :childid; if (sqlca.sqlcode) break; - + + strcpy(childname, strtrim(childname)); /* concatenate the new parent name with the existing sub-container name * we get the sub-containers new name */ tmpchar = childname + strlen(name); diff --git a/server/queries2.c b/server/queries2.c index e3229a75..046ae23a 100644 --- a/server/queries2.c +++ b/server/queries2.c @@ -3218,6 +3218,19 @@ static struct valobj amcn_valobj[] = /* ADD_MACHINE_TO_CONTAINER */ }; static struct validate amcn_validate = /* for amtn and dmfn */ +{ + amcn_valobj, + 2, + "mach_id", + "mach_id = %d", + 1, + 0, + access_container, + 0, + set_mach_modtime_by_id, +}; + +static struct validate dmcn_validate = /* for amtn and dmfn */ { amcn_valobj, 2, @@ -6685,7 +6698,7 @@ struct query Queries[] = { "mach_id = %d AND cnt_id = %d", 2, NULL, - &amcn_validate, + &dmcn_validate, }, { -- 2.45.2