Eliminated Debug Prints

This commit is contained in:
Chris Mann 2023-07-17 17:23:03 +02:00
parent a480ebbe36
commit d269f3088f
2 changed files with 28 additions and 28 deletions

View File

@ -195,7 +195,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
modify_request.Add("member", []string{member}) modify_request.Add("member", []string{member})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("198: %v",modify_request)) // log.Printf(fmt.Sprintf("198: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -237,7 +237,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
if sn != "" { if sn != "" {
req.Attribute("sn", []string{sn}) req.Attribute("sn", []string{sn})
} }
log.Printf(fmt.Sprintf("226: %v",req)) // log.Printf(fmt.Sprintf("226: %v",req))
err := login.conn.Add(req) err := login.conn.Add(req)
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
@ -246,7 +246,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
modify_request.Add("member", []string{guestDn}) modify_request.Add("member", []string{guestDn})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("249: %v",modify_request)) // log.Printf(fmt.Sprintf("249: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -261,7 +261,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
modify_request.Add("member", []string{sr.Entries[0].DN}) modify_request.Add("member", []string{sr.Entries[0].DN})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("264: %v",modify_request)) // log.Printf(fmt.Sprintf("264: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -277,7 +277,7 @@ func handleAdminMailingList(w http.ResponseWriter, r *http.Request) {
modify_request.Delete("member", []string{member}) modify_request.Delete("member", []string{member})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("280: %v",modify_request)) // log.Printf(fmt.Sprintf("280: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -431,7 +431,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
Active: dn == config.BaseDN, Active: dn == config.BaseDN,
}, },
} }
log.Printf(fmt.Sprintf("434: %v",path)) // log.Printf(fmt.Sprintf("434: %v",path))
len_base_dn := len(strings.Split(config.BaseDN, ",")) len_base_dn := len(strings.Split(config.BaseDN, ","))
dn_split := strings.Split(dn, ",") dn_split := strings.Split(dn, ",")
@ -443,7 +443,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
Active: i == len(dn_split), Active: i == len(dn_split),
}) })
} }
log.Printf(fmt.Sprintf("446: %v",path)) // log.Printf(fmt.Sprintf("446: %v",path))
// Handle modification operation // Handle modification operation
@ -468,7 +468,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
modify_request.Replace(attr, values_filtered) modify_request.Replace(attr, values_filtered)
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("468: %v",modify_request)) // log.Printf(fmt.Sprintf("468: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -490,7 +490,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
modify_request.Add(attr, values_filtered) modify_request.Add(attr, values_filtered)
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("490: %v",modify_request)) // log.Printf(fmt.Sprintf("490: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -503,7 +503,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
modify_request.Replace(attr, []string{}) modify_request.Replace(attr, []string{})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("503: %v",modify_request)) // log.Printf(fmt.Sprintf("503: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -515,7 +515,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
modify_request.Delete("member", []string{dn}) modify_request.Delete("member", []string{dn})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("515: %v",modify_request)) // log.Printf(fmt.Sprintf("515: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -527,7 +527,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
modify_request.Add("member", []string{dn}) modify_request.Add("member", []string{dn})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("527: %v",modify_request)) // log.Printf(fmt.Sprintf("527: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -539,7 +539,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
modify_request.Delete("member", []string{member}) modify_request.Delete("member", []string{member})
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("539: %v",modify_request)) // log.Printf(fmt.Sprintf("539: %v",modify_request))
if err != nil { if err != nil {
dError = err.Error() dError = err.Error()
} else { } else {
@ -566,7 +566,7 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
nil) nil)
sr, err := login.conn.Search(searchRequest) sr, err := login.conn.Search(searchRequest)
log.Printf(fmt.Sprintf("569: %v",searchRequest)) // log.Printf(fmt.Sprintf("569: %v",searchRequest))
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
@ -702,13 +702,13 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
fmt.Sprintf("(&(objectClass=groupOfNames)(member=%s))",dn), fmt.Sprintf("(&(objectClass=groupOfNames)(member=%s))",dn),
[]string{"dn", "displayName", "cn", "description"}, []string{"dn", "displayName", "cn", "description"},
nil) nil)
log.Printf(fmt.Sprintf("708: %v",searchRequest)) // log.Printf(fmt.Sprintf("708: %v",searchRequest))
sr, err = login.conn.Search(searchRequest) sr, err = login.conn.Search(searchRequest)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
} }
log.Printf(fmt.Sprintf("714: %v",sr.Entries)) // log.Printf(fmt.Sprintf("714: %v",sr.Entries))
for _, ent := range sr.Entries { for _, ent := range sr.Entries {
groups = append(groups, EntryName{ groups = append(groups, EntryName{
DN: ent.DN, DN: ent.DN,
@ -721,13 +721,13 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
fmt.Sprintf("(&(objectClass=groupOfNames)(!(member=%s)))",dn), fmt.Sprintf("(&(objectClass=groupOfNames)(!(member=%s)))",dn),
[]string{"dn", "displayName", "cn", "description"}, []string{"dn", "displayName", "cn", "description"},
nil) nil)
log.Printf(fmt.Sprintf("724: %v",searchRequest)) // log.Printf(fmt.Sprintf("724: %v",searchRequest))
sr, err = login.conn.Search(searchRequest) sr, err = login.conn.Search(searchRequest)
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
return return
} }
log.Printf(fmt.Sprintf("714: %v",sr.Entries)) // log.Printf(fmt.Sprintf("714: %v",sr.Entries))
for _, ent := range sr.Entries { for _, ent := range sr.Entries {
possibleNewGroups = append(possibleNewGroups, EntryName{ possibleNewGroups = append(possibleNewGroups, EntryName{
DN: ent.DN, DN: ent.DN,
@ -737,9 +737,9 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
// possibleNewGroup.DN = ent.GetAttributeValue("dn") // possibleNewGroup.DN = ent.GetAttributeValue("dn")
// possibleNewGroup.Name = ent.GetAttributeValue("cn") // possibleNewGroup.Name = ent.GetAttributeValue("cn")
// log.Printf(fmt.Sprintf("725: %v %v",dn, ent.GetAttributeValue("member"))) // // log.Printf(fmt.Sprintf("725: %v %v",dn, ent.GetAttributeValue("member")))
// for _, member := range ent .GetAttributeValue("member") { // for _, member := range ent .GetAttributeValue("member") {
// // log.Printf(fmt.Sprintf("725: %v %v",dn, member)) // // // log.Printf(fmt.Sprintf("725: %v %v",dn, member))
// if ent.GetAttributeValue("member") == dn { // if ent.GetAttributeValue("member") == dn {
// groups = append(groups,possibleNewGroup,) // groups = append(groups,possibleNewGroup,)
// possibleNewGroup.DN = "" // possibleNewGroup.DN = ""
@ -761,9 +761,9 @@ func handleAdminLDAP(w http.ResponseWriter, r *http.Request) {
// } // }
// // Calculate list of current groups // // Calculate list of current groups
// log.Printf(fmt.Sprintf("%v",groups_dn)) // // log.Printf(fmt.Sprintf("%v",groups_dn))
// for _, grpdn := range groups_dn { // for _, grpdn := range groups_dn {
// log.Printf(fmt.Sprintf("%v",grpdn)) // // log.Printf(fmt.Sprintf("%v",grpdn))
// groups = append(groups, EntryName{ // groups = append(groups, EntryName{
// DN: grpdn, // DN: grpdn,
// Name: groupMap[grpdn], // Name: groupMap[grpdn],
@ -991,9 +991,9 @@ func handleAdminCreate(w http.ResponseWriter, r *http.Request) {
req.Attribute("description", []string{data.Description}) req.Attribute("description", []string{data.Description})
} }
err := login.conn.Add(req) err := login.conn.Add(req)
log.Printf(fmt.Sprintf("899: %v",err)) // log.Printf(fmt.Sprintf("899: %v",err))
log.Printf(fmt.Sprintf("899: %v",req)) // log.Printf(fmt.Sprintf("899: %v",req))
log.Printf(fmt.Sprintf("899: %v",data)) // log.Printf(fmt.Sprintf("899: %v",data))
if err != nil { if err != nil {
data.Error = err.Error() data.Error = err.Error()
} else { } else {

View File

@ -81,9 +81,9 @@ func handleProfile(w http.ResponseWriter, r *http.Request) {
// } // }
err := login.conn.Modify(modify_request) err := login.conn.Modify(modify_request)
log.Printf(fmt.Sprintf("Profile:079: %v",modify_request)) // log.Printf(fmt.Sprintf("Profile:079: %v",modify_request))
log.Printf(fmt.Sprintf("Profile:079: %v",err)) // log.Printf(fmt.Sprintf("Profile:079: %v",err))
log.Printf(fmt.Sprintf("Profile:079: %v",data)) // log.Printf(fmt.Sprintf("Profile:079: %v",data))
if err != nil { if err != nil {
data.ErrorMessage = err.Error() data.ErrorMessage = err.Error()
} else { } else {