From 3c101475248488867be85765831cd52b04749069 Mon Sep 17 00:00:00 2001 From: Roman Maksimov Date: Fri, 7 Feb 2020 00:10:27 +0300 Subject: [PATCH] add misc fixes --- forms/rulerforms.go | 2 +- mapi/datastructs.go | 8 ++++---- mapi/mapi.go | 8 ++++---- rpc-http/packets.go | 2 -- ruler.go | 4 ++-- utils/datatypes.go | 2 +- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/forms/rulerforms.go b/forms/rulerforms.go index b3b9674..d2580b2 100644 --- a/forms/rulerforms.go +++ b/forms/rulerforms.go @@ -237,7 +237,7 @@ func DeleteForm(suffix string, folderid []byte) ([]byte, error) { ruleid := v.RuleID err = mapi.ExecuteMailRuleDelete(ruleid) if err != nil { - utils.Error.Printf("Failed to delete rule") + utils.Error.Println("Failed to delete rule") return nil, err } utils.Info.Println("Rule deleted successfully") diff --git a/mapi/datastructs.go b/mapi/datastructs.go index 825f4d7..1f4f767 100644 --- a/mapi/datastructs.go +++ b/mapi/datastructs.go @@ -73,7 +73,7 @@ type ExecuteResponse struct { AuxilliaryBuf []byte } -//ConnectResponse strcut +//ConnectResponse struct type ConnectResponse struct { StatusCode uint32 //if 0x00000 --> failure and we only have AuzilliaryBufferSize and AuxilliaryBuffer ErrorCode uint32 @@ -826,7 +826,7 @@ type RopReadStreamRequest struct { MaximumByteCount uint32 } -//RopRestrictRequest strcut +//RopRestrictRequest struct type RopRestrictRequest struct { RopID uint8 //0x14 LogonID uint8 @@ -836,7 +836,7 @@ type RopRestrictRequest struct { RestrictionData []byte } -//RopRestrictResponse strcut +//RopRestrictResponse struct type RopRestrictResponse struct { RopID uint8 //0x14 InputHandleIndex uint8 @@ -929,7 +929,7 @@ type RopModifyRulesResponse struct { ReturnValue uint32 } -//RopGetRulesTableResponse strcut +//RopGetRulesTableResponse struct type RopGetRulesTableResponse struct { RopID uint8 OutputHandleIndex uint8 diff --git a/mapi/mapi.go b/mapi/mapi.go index 20f9c66..73130a2 100644 --- a/mapi/mapi.go +++ b/mapi/mapi.go @@ -341,7 +341,7 @@ func readResponse(headers http.Header, body []byte) ([]byte, error) { return body[start+4:], nil } -//Authenticate is used to create the MAPI session, get's session cookie ect +//Authenticate is used to create the MAPI session, get's session cookie etc func Authenticate() (*RopLogonResponse, error) { if AuthSession.Transport == RPC { return AuthenticateRPC() @@ -385,7 +385,7 @@ func AuthenticateRPC() (*RopLogonResponse, error) { return nil, &TransportError{fmt.Errorf("An error occurred setting up RPC. %s", err)} } - utils.Trace.Println("User DN: ", string(connRequest.UserDN)) + utils.Trace.Printf("User DN: %s", string(connRequest.UserDN)) utils.Trace.Println("Got Context, Doing ROPLogin") AuthSession.UserDN = append([]byte(AuthSession.LID), []byte{0x00}...) @@ -418,7 +418,7 @@ func AuthenticateHTTP() (*RopLogonResponse, error) { connResponse.Unmarshal(responseBody) if connResponse.StatusCode == 0 { - utils.Trace.Println("User DN: ", string(connRequest.UserDN)) + utils.Trace.Printf("User DN: %s", string(connRequest.UserDN)) utils.Trace.Println("Got Context, Doing ROPLogin") AuthSession.UserDN = connRequest.UserDN @@ -2037,7 +2037,7 @@ func FastTransferFetchStep(handles []byte) ([]byte, error) { pprops := RopFastTransferSourceGetBufferResponse{} rops := []RopResponse{&pprops} bufPtr, e := UnmarshalRops(execResponse.RopBuffer.Body, rops) - utils.Trace.Printf("Large transfer in progress. Status: %d ", pprops.TransferStatus) + utils.Trace.Printf("Large transfer in progress. Status: %d", pprops.TransferStatus) if pprops.TransferStatus == 0x0001 { buff, err := FastTransferFetchStep(execResponse.RopBuffer.Body[bufPtr:]) diff --git a/rpc-http/packets.go b/rpc-http/packets.go index 400066c..62a8549 100644 --- a/rpc-http/packets.go +++ b/rpc-http/packets.go @@ -480,8 +480,6 @@ func (response *RPCResponse) Unmarshal(raw []byte) (int, error) { return pos, nil } response.SecTrailer, pos = utils.ReadBytes(pos, int(response.Header.AuthLen), raw) - } else { - } } return pos, nil diff --git a/ruler.go b/ruler.go index 8d73cfc..2fa10a8 100644 --- a/ruler.go +++ b/ruler.go @@ -227,7 +227,7 @@ func deleteRule(c *cli.Context) error { ruleid = v.RuleID err = mapi.ExecuteMailRuleDelete(ruleid) if err != nil { - utils.Error.Printf("Failed to delete rule") + utils.Error.Println("Failed to delete rule") } } } @@ -242,7 +242,7 @@ func deleteRule(c *cli.Context) error { } err = mapi.ExecuteMailRuleDelete(ruleid) if err != nil { - utils.Error.Printf("Failed to delete rule") + utils.Error.Println("Failed to delete rule") } } diff --git a/utils/datatypes.go b/utils/datatypes.go index fadaf1a..6dbe486 100644 --- a/utils/datatypes.go +++ b/utils/datatypes.go @@ -20,7 +20,7 @@ type Config struct { Proxy string } -//Session stores authentication cookies ect +//Session stores authentication cookies etc type Session struct { User string Pass string