s4:dcesrv_samr - Add more checks for invalid levels
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 10 Nov 2009 15:26:23 +0000 (16:26 +0100)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 10 Nov 2009 15:26:23 +0000 (16:26 +0100)
Add more checks on valid levels, mark unimplemented ones as "UNSUPPORTED" and
otherwise as "INVALID_INFO_CLASS" to be safe.

source4/rpc_server/samr/dcesrv_samr.c

index 641b35c2dadc7fa99bf200d903a818db2560b8bd..0b102b5e791f6751a222e7166e53680c74522cbf 100644 (file)
@@ -797,8 +797,10 @@ static NTSTATUS dcesrv_samr_QueryDomainInfo(struct dcesrv_call_state *dce_call,
                break;
        }
        case 9:
                break;
        }
        case 9:
+       {
                attrs = NULL;
                attrs = NULL;
-               break;          
+               break;
+       }
        case 11:
        {
                static const char * const attrs2[] = { "oEMInformation",
        case 11:
        {
                static const char * const attrs2[] = { "oEMInformation",
@@ -828,6 +830,10 @@ static NTSTATUS dcesrv_samr_QueryDomainInfo(struct dcesrv_call_state *dce_call,
                attrs = attrs2;
                break;
        }
                attrs = attrs2;
                break;
        }
+       default:
+       {
+               return NT_STATUS_INVALID_INFO_CLASS;
+       }
        }
 
        /* some levels don't need a search */
        }
 
        /* some levels don't need a search */
@@ -881,9 +887,9 @@ static NTSTATUS dcesrv_samr_QueryDomainInfo(struct dcesrv_call_state *dce_call,
        case 13:
                return dcesrv_samr_info_DomInfo13(d_state, mem_ctx, dom_msgs, 
                                                  &info->info13);
        case 13:
                return dcesrv_samr_info_DomInfo13(d_state, mem_ctx, dom_msgs, 
                                                  &info->info13);
+       default:
+               return NT_STATUS_INVALID_INFO_CLASS;
        }
        }
-
-       return NT_STATUS_INVALID_INFO_CLASS;
 }
 
 
 }
 
 
@@ -3148,6 +3154,10 @@ static NTSTATUS dcesrv_samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TA
                attrs = attrs2;
                break;
        }
                attrs = attrs2;
                break;
        }
+       case 18:
+       {
+               return NT_STATUS_NOT_SUPPORTED;
+       }
        case 20:
        {
                static const char * const attrs2[] = {"userParameters",
        case 20:
        {
                static const char * const attrs2[] = {"userParameters",
@@ -3183,6 +3193,17 @@ static NTSTATUS dcesrv_samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TA
                attrs = attrs2;
                break;
        }
                attrs = attrs2;
                break;
        }
+       case 23:
+       case 24:
+       case 25:
+       case 26:
+       {
+               return NT_STATUS_NOT_SUPPORTED;
+       }
+       default:
+       {
+               return NT_STATUS_INVALID_INFO_CLASS;
+       }
        }
 
        /* pull all the user attributes */
        }
 
        /* pull all the user attributes */
@@ -4401,6 +4422,9 @@ static NTSTATUS dcesrv_samr_ValidatePassword(struct dcesrv_call_state *dce_call,
                                           pwInfo.min_password_length);
                (*r->out.rep)->ctr3.status = res;
        break;
                                           pwInfo.min_password_length);
                (*r->out.rep)->ctr3.status = res;
        break;
+       default:
+               return NT_STATUS_INVALID_INFO_CLASS;
+       break;
        }
 
        return NT_STATUS_OK;
        }
 
        return NT_STATUS_OK;