Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Windows SessionID=0 #25582

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/25581-session-id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix Windows MDM issue where SessionID of 0 was not allowed.
2 changes: 1 addition & 1 deletion pkg/mdm/mdmtest/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (c *TestWindowsMDMClient) StartManagementSession() (map[string]fleet.ProtoC
<SyncHdr>
<VerDTD>1.2</VerDTD>
<VerProto>DM/1.2</VerProto>
<SessionID>` + fmt.Sprint(sessionIDInt+1) + `</SessionID>
<SessionID>` + fmt.Sprint(sessionIDInt) + `</SessionID>
<MsgID>1</MsgID>
<Target>
<LocURI>` + c.fleetServerURL + microsoft_mdm.MDE2ManagementPath + `</LocURI>
Expand Down
13 changes: 2 additions & 11 deletions server/service/microsoft_mdm.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ func mdmMicrosoftEnrollEndpoint(ctx context.Context, request interface{}, svc fl
// and better security authentication (done through TLS and in-message hash)
func mdmMicrosoftManagementEndpoint(ctx context.Context, request interface{}, svc fleet.Service) (errorer, error) {
reqSyncML := request.(*SyncMLReqMsgContainer).Data
reqCerts := request.(*SyncMLReqMsgContainer).Certs

// Checking first if incoming SyncML message is valid and returning error if this is not the case
if err := reqSyncML.IsValidMsg(); err != nil {
Expand All @@ -906,7 +905,7 @@ func mdmMicrosoftManagementEndpoint(ctx context.Context, request interface{}, sv
}

// Getting the MS-MDM response message
resSyncML, err := svc.GetMDMWindowsManagementResponse(ctx, reqSyncML, reqCerts)
resSyncML, err := svc.GetMDMWindowsManagementResponse(ctx, reqSyncML, request.(*SyncMLReqMsgContainer).Certs)
if err != nil {
soapFault := svc.GetAuthorizedSoapFault(ctx, syncml.SoapErrorMessageFormat, mdm_types.MSMDM, err)
return getSoapResponseFault(reqSyncML.SyncHdr.MsgID, soapFault), nil
Expand Down Expand Up @@ -1624,12 +1623,8 @@ func (svc *Service) getManagementResponse(ctx context.Context, reqMsg *fleet.Syn
return nil, fmt.Errorf("message processing error %w", err)
}

// Combined cmd responses
resCmds := resIncomingCmds
resCmds = append(resCmds, resPendingCmds...)

// Create the response SyncML message
msg, err := svc.createResponseSyncML(ctx, reqMsg, resCmds)
msg, err := svc.createResponseSyncML(ctx, reqMsg, append(resIncomingCmds, resPendingCmds...))
if err != nil {
return nil, fmt.Errorf("message syncML creation error %w", err)
}
Expand Down Expand Up @@ -1902,10 +1897,6 @@ func createSyncMLMessage(sessionID string, msgID string, deviceID string, source
return nil, errors.New("invalid parameters")
}

if sessionID == "0" {
return nil, errors.New("invalid session ID")
}

if msgID == "0" {
return nil, errors.New("invalid msg ID")
}
Expand Down
Loading