 +	fmt.Printf("AuthenticatePrincipalRequest request %d, ", len(message))
 +	fmt.Printf("\n")
 +	_, _ = ms.WriteString(string(message))
+#*
+#* author: Tom Roeder
+#* email: tmroeder@google.com
+#* date: 2014-10-24T11:58:01-0700
+#*
+#- Check the error
+#-
 +	fmt.Printf("AuthenticatePrincipalRequest: sent request\n")
 +	SendProtocolMessage(ms, len(derCert), derCert)
+#*
+#* author: Tom Roeder
+#* email: tmroeder@google.com
+#* date: 2014-10-24T11:58:20-0700
+#*
+#- Length not needed.
+#-
 +	fmt.Printf("AuthenticatePrincipalRequest: sent cert\n")
 +	nonce, err := GetProtocolMessage(ms)
 +	if err != nil {

+// Some fake additional statements for the purpose of testing the guard.
+var additional_policy = []string{
+	"FileServer(\"fileserver\")",
+	"Action(\"create\")",
+	"Action(\"getfile\")",
+	"Action(\"sendfile\")",

+
+	hostDomain, err := tao.LoadDomain(*hostcfg, nil)
+	if err != nil {
#*
#* author: Tom Roeder
#* email: tmroeder@google.com
#* date: 2014-10-22T15:41:33-0700
#*
#- Print the error here rather than printing down in the depths of the code.
#- E.g., something like
#-
#- if err != nil {
#-   log.Fatalf("Couldn't load the Tao Domain: %s\n", err)
#- }
#-
#- Note that log.Fatal{,f,ln} kills the program after printing the log entry.
#- Import the "log" package to use it.
#-
#- Also, don't litter the code with fmt.Printf. Use log for debugging so that
#- it's easy to turn on and off.
+		return
+	}
+	DerPolicyCert = nil
#*
#* author: Tom Roeder
#* email: tmroeder@google.com
#* date: 2014-10-22T15:43:53-0700
#*
#- Under the standard Go naming conventions, initial caps are reserved for
#- exported values. Instead, this should be derPolicyCert. Also, abbreviations
#- like DER are supposed to be consistent in their caps: either ALL CAPS or all
#- lowercase. Fortunately, derPolicyCert already satisfies that constraint.
#-
#- Also, note that DerPolicyCert is nil by default, so it doesn't need to be set
#- to nil explicitly.
#-
+	if hostDomain.Keys.Cert != nil {
+		DerPolicyCert = hostDomain.Keys.Cert.Raw
+	}
+	if DerPolicyCert == nil {
+		fmt.Printf("can't retrieve policy cert\n")
#*
#* author: Tom Roeder
#* email: tmroeder@google.com
#* date: 2014-10-22T15:46:32-0700
#*
#- Use log.Fatalln and drop the explicit newline. And if you're printing a
#- single string with a newline, use one of the functions that ends in "ln"
#- rather than using a formatting one and adding a newline manually.
#-
+		return
+	}
+
