~zulcss/ubuntu/lucid/likewise-open/likewise-open-sru

« back to all changes in this revision

Viewing changes to samba/source/winbindd/likewise/idmap_lwicompat_v4.c

  • Committer: Bazaar Package Importer
  • Author(s): Rick Clark
  • Date: 2008-08-27 08:56:20 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080827085620-5q0f58b9qtog9myq
Tags: 4.1.0.2956-0ubuntu1
* missing-likewise-logo.diff: removed
* fixed copyright notice
* updated Standards-Version to 3.8.0
* removed path from command in prerm
* removed stop in S runlevel

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
        NTSTATUS(*close_fn) (struct idmap_domain * dom);
75
75
};
76
76
 
 
77
const char* sid_string_static(const DOM_SID*);
 
78
 
77
79
/*********************************************************************
78
80
 ********************************************************************/
79
81
 
140
142
        NSS_STATUS result;
141
143
        struct winbindd_request request;
142
144
        struct winbindd_response response;
143
 
        struct unixid *ret_id = NULL;
144
 
        DOM_SID *sids = NULL;
145
 
        int count, i;
 
145
        int count;
 
146
        enum winbindd_cmd cmd;
146
147
 
147
148
        /* figure out how many SIDS we havs */
148
149
 
150
151
                /* do nothing */
151
152
        }
152
153
 
153
 
        if (count == 0)
 
154
        if (count == 0)  {
154
155
                return NT_STATUS_OK;
 
156
        }
 
157
 
 
158
        if (count > 1) {                
 
159
                return NT_STATUS_INVALID_PARAMETER;
 
160
        }
155
161
 
156
162
        ZERO_STRUCT(request);
157
163
        ZERO_STRUCT(response);
158
164
 
159
 
        /* allocate the DOM_SID array for the request */
 
165
        fstrcpy(request.data.sid, sid_string_static(ids[0]->sid));
160
166
 
161
 
        request.extra_len = count * sizeof(DOM_SID);
162
 
        sids = SMB_MALLOC_ARRAY(DOM_SID, count);
163
 
        for (i = 0; i < count; i++) {
164
 
                sid_copy(&sids[i], ids[i]->sid);
 
167
        switch (ids[0]->xid.type) {
 
168
        case ID_TYPE_UID:
 
169
                cmd = WINBINDD_SID_TO_UID;
 
170
                break;
 
171
        case ID_TYPE_GID:
 
172
                cmd = WINBINDD_SID_TO_GID;
 
173
                break;
 
174
        default:
 
175
                DEBUG(4,("lwi_get_id_from_sid: Unknown query type (%u)\n",
 
176
                        ids[0]->xid.type));
 
177
                return NT_STATUS_INVALID_PARAMETER;
165
178
        }
166
 
        request.extra_data.data = (char *)sids;
167
179
 
168
180
        /* Make request */
169
181
 
170
 
        result = winbindd_request_response(WINBINDD_SIDS_TO_XIDS,
171
 
                                           &request, &response);
 
182
        result = winbindd_request_response(cmd, &request, &response);
172
183
 
173
184
        if (result != NSS_STATUS_SUCCESS)
174
185
                return NT_STATUS_NONE_MAPPED;
175
186
 
176
187
        /* gather the responses */
177
188
 
178
 
        ret_id = (struct unixid *)response.extra_data.data;
179
 
        for (i = 0; i < count; i++) {
180
 
                if (ret_id[i].type == -1) {
181
 
                        ids[i]->status = ID_UNMAPPED;
182
 
                        continue;
183
 
                }
184
 
 
185
 
                ids[i]->status = ID_MAPPED;
186
 
                ids[i]->xid.type = ret_id[i].type;
187
 
                ids[i]->xid.id = ret_id[i].id;
188
 
        }
189
 
 
190
 
        SAFE_FREE(request.extra_data.data);
 
189
        ids[0]->xid.id = response.data.uid;
 
190
        ids[0]->status = ID_MAPPED;
 
191
 
191
192
        SAFE_FREE(response.extra_data.data);
192
193
 
193
194
        return NT_STATUS_OK;