mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-06 22:30:56 +03:00
printf: replace %#v with the more explicit %q
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -118,13 +118,13 @@ func loadCACerts(configDir string) error {
|
||||
caPath := getConfigPath(ca, configDir)
|
||||
certs, err := os.ReadFile(caPath)
|
||||
if err != nil {
|
||||
logger.Warn(logSender, "", "error loading ca cert %#v: %v", caPath, err)
|
||||
logger.Warn(logSender, "", "error loading ca cert %q: %v", caPath, err)
|
||||
return err
|
||||
}
|
||||
if !rootCAs.AppendCertsFromPEM(certs) {
|
||||
logger.Warn(logSender, "", "unable to add ca cert %#v", caPath)
|
||||
logger.Warn(logSender, "", "unable to add ca cert %q", caPath)
|
||||
} else {
|
||||
logger.Debug(logSender, "", "ca cert %#v added to the trusted certificates", caPath)
|
||||
logger.Debug(logSender, "", "ca cert %q added to the trusted certificates", caPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
sr, err := l.Search(searchRequest)
|
||||
if err != nil {
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "error searching LDAP user %#v: %v", authReq.Username, err)
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "error searching LDAP user %q: %v", authReq.Username, err)
|
||||
sendAPIResponse(w, r, err, "Error searching LDAP user", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) {
|
||||
if len(authReq.PublicKey) > 0 {
|
||||
userKey, _, _, _, err := ssh.ParseAuthorizedKey([]byte(authReq.PublicKey))
|
||||
if err != nil {
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "invalid public key for user %#v: %v", authReq.Username, err)
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "invalid public key for user %q: %v", authReq.Username, err)
|
||||
sendAPIResponse(w, r, err, "Invalid public key", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
@@ -116,7 +116,7 @@ func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
if !authOk {
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "public key authentication failed for user: %#v", authReq.Username)
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "public key authentication failed for user: %q", authReq.Username)
|
||||
sendAPIResponse(w, r, nil, "public key authentication failed", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
@@ -125,7 +125,7 @@ func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) {
|
||||
userdn := sr.Entries[0].DN
|
||||
err = l.Bind(userdn, authReq.Password)
|
||||
if err != nil {
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "password authentication failed for user: %#v", authReq.Username)
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "password authentication failed for user: %q", authReq.Username)
|
||||
sendAPIResponse(w, r, nil, "password authentication failed", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func checkSFTPGoUserAuth(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
user, err := getSFTPGoUser(sr.Entries[0], authReq.Username)
|
||||
if err != nil {
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "get user from LDAP entry failed for username %#v: %v",
|
||||
logger.Warn(logSender, middleware.GetReqID(r.Context()), "get user from LDAP entry failed for username %q: %v",
|
||||
authReq.Username, err)
|
||||
sendAPIResponse(w, r, err, "mapping LDAP user failed", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user