@@ -441,6 +441,14 @@ func licenceAddHandler(w http.ResponseWriter, r *http.Request) {
441
441
return
442
442
}
443
443
444
+ // The "public" user isn't allowed to make changes
445
+ if userAcc == "public" {
446
+ log .Printf ("User from '%s' attempted to add a licence using the public certificate" , r .RemoteAddr )
447
+ http .Error (w , "You're using the 'public' certificate, which isn't allowed to make changes on the server" ,
448
+ http .StatusUnauthorized )
449
+ return
450
+ }
451
+
444
452
// Check whether the uploaded licence file is too large
445
453
if r .ContentLength > (com .MaxLicenceSize * 1024 * 1024 ) {
446
454
http .Error (w ,
@@ -675,6 +683,14 @@ func licenceRemoveHandler(w http.ResponseWriter, r *http.Request) {
675
683
return
676
684
}
677
685
686
+ // The "public" user isn't allowed to make changes
687
+ if userAcc == "public" {
688
+ log .Printf ("User from '%s' attempted to remove a licence using the public certificate" , r .RemoteAddr )
689
+ http .Error (w , "You're using the 'public' certificate, which isn't allowed to make changes on the server" ,
690
+ http .StatusUnauthorized )
691
+ return
692
+ }
693
+
678
694
// Make sure a licence short name was provided
679
695
l := r .FormValue ("licence_id" )
680
696
if l == "" {
@@ -826,6 +842,14 @@ func postHandler(w http.ResponseWriter, r *http.Request, userAcc string) {
826
842
// Set the maximum accepted database size for uploading
827
843
r .Body = http .MaxBytesReader (w , r .Body , com .MaxDatabaseSize * 1024 * 1024 )
828
844
845
+ // The "public" user isn't allowed to make changes
846
+ if userAcc == "public" {
847
+ log .Printf ("User from '%s' attempted to add a database using the public certificate" , r .RemoteAddr )
848
+ http .Error (w , "You're using the 'public' certificate, which isn't allowed to make changes on the server" ,
849
+ http .StatusUnauthorized )
850
+ return
851
+ }
852
+
829
853
// Split the request URL into path components
830
854
pathStrings := strings .Split (r .URL .Path , "/" )
831
855
0 commit comments