Restore Go 1.15 compatibility.

This commit is contained in:
Solderpunk 2023-03-04 14:27:01 +01:00
parent e30f39b196
commit 72a94cab00
2 changed files with 12 additions and 3 deletions

View File

@ -4,7 +4,7 @@ import (
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"encoding/pem" "encoding/pem"
"io" "io/ioutil"
"log" "log"
"os" "os"
"os/signal" "os/signal"
@ -65,7 +65,7 @@ func launch(sysConfig SysConfig, userConfig UserConfig, privInfo userInfo) int {
log.Println("Error opening TLS certificate file: " + err.Error()) log.Println("Error opening TLS certificate file: " + err.Error())
return 1 return 1
} }
certBytes, err := io.ReadAll(certFile) certBytes, err := ioutil.ReadAll(certFile)
if err != nil { if err != nil {
log.Println("Error reading TLS certificate file: " + err.Error()) log.Println("Error reading TLS certificate file: " + err.Error())
return 1 return 1

View File

@ -3,10 +3,19 @@
package main package main
import ( import (
"errors"
"log" "log"
"os" "os"
) )
type userInfo struct {
}
func getUserInfo(unprivUser string) (userInfo, error) {
var dummy userInfo
return dummy, nil
}
func enableSecurityRestrictions(config SysConfig, ui userInfo) error { func enableSecurityRestrictions(config SysConfig, ui userInfo) error {
// Prior to Go 1.6, setuid did not work reliably on Linux // Prior to Go 1.6, setuid did not work reliably on Linux
@ -16,7 +25,7 @@ func enableSecurityRestrictions(config SysConfig, ui userInfo) error {
if uid == 0 || euid == 0 { if uid == 0 || euid == 0 {
setuid_err := "Refusing to run with root privileges when setuid() will not work!" setuid_err := "Refusing to run with root privileges when setuid() will not work!"
log.Println(setuid_err) log.Println(setuid_err)
return error.New(setuid_err) return errors.New(setuid_err)
} }
return nil return nil