From f440f558230e474032948f52f04f17bf4f17192a Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 12 Jul 2016 00:20:36 -0700 Subject: [PATCH] GUACAMOLE-5: Validate that data was provided when creating/updating resources. --- .../guacamole/rest/directory/DirectoryObjectResource.java | 8 ++++++++ .../guacamole/rest/directory/DirectoryResource.java | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryObjectResource.java b/guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryObjectResource.java index 298f76b56..7e45b2b82 100644 --- a/guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryObjectResource.java +++ b/guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryObjectResource.java @@ -27,6 +27,7 @@ import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; +import org.apache.guacamole.GuacamoleClientException; import org.apache.guacamole.GuacamoleException; import org.apache.guacamole.net.auth.Directory; import org.apache.guacamole.net.auth.Identifiable; @@ -120,8 +121,15 @@ public class DirectoryObjectResource public ExternalType createObject(ExternalType object) throws GuacamoleException { + // Validate that data was provided + if (object == null) + throw new GuacamoleClientException("Data must be submitted when creating objects."); + // Create the new object within the directory directory.add(translator.toInternalObject(object));