server.c revision 148c5f43199ca0b43fc8e3b643aab11cd66ea327
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * CDDL HEADER START
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * The contents of this file are subject to the terms of the
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * Common Development and Distribution License (the "License").
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * You may not use this file except in compliance with the License.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * See the License for the specific language governing permissions
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * and limitations under the License.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * When distributing Covered Code, include this CDDL HEADER in each
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * If applicable, add the following below this CDDL HEADER, with the
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * fields enclosed by brackets "[]" replaced with your own identifying
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * information: Portions Copyright [yyyy] [name of copyright owner]
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * CDDL HEADER END
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * Service routines
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States#include <sys/sid.h>
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw retcode = validate_list_cb_data(cb_data, argc, argv, col,\
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (0);\
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw } else if (retcode < 0) {\
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (1);\
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp#define PROCESS_LIST_SVC_SQL(rcode, db, dbname, sql, limit, flag, cb, res, len)\
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp rcode = process_list_svc_sql(db, dbname, sql, limit, flag, cb, res);\
8e22821528b08c6dba4e8176351560f316f6d0dedm return (1); \
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
334e34639228c5021a69504cca69d70d851c52fababan * RPC layer allocates empty strings to replace NULL char *.
334e34639228c5021a69504cca69d70d851c52fababan * This utility function frees these empty strings.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Init */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Return success if nothing was requested */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Get cache handle */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Get db handle */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Allocate result array */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw result->ids.ids_val = calloc(batch.idmap_mapping_batch_len,
62c6006265c37877b7a5b3c8ffce913ef559b955baban /* Allocate hash table to check for duplicate sids */
62c6006265c37877b7a5b3c8ffce913ef559b955baban state.sid_history = calloc(batch.idmap_mapping_batch_len,
62c6006265c37877b7a5b3c8ffce913ef559b955baban state.sid_history_size = batch.idmap_mapping_batch_len;
e8c27ec857e6e2db8c4fe56938b70a89b5bed9f3baban /* Get directory-based name mapping info */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Init our 'done' flags */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* First stage */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Check if we are done */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw if (state.sid2pid_done == TRUE && state.pid2sid_done == TRUE)
e8c27ec857e6e2db8c4fe56938b70a89b5bed9f3baban * native LDAP lookups:
479ac37569625bae44ffb80071d4bc865fc710eddm * pid2sid:
479ac37569625bae44ffb80071d4bc865fc710eddm * - nldap or mixed mode. Lookup nldap by pid or unixname to get
479ac37569625bae44ffb80071d4bc865fc710eddm * winname.
479ac37569625bae44ffb80071d4bc865fc710eddm * sid2pid:
479ac37569625bae44ffb80071d4bc865fc710eddm * - nldap mode. Got winname and sid (either given or found in
479ac37569625bae44ffb80071d4bc865fc710eddm * name_cache). Lookup nldap by winname to get pid and
479ac37569625bae44ffb80071d4bc865fc710eddm * unixname.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright TRACE(req, res, "Native LDAP lookup error=%d", retcode);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright for (i = 0; i < batch.idmap_mapping_batch_len; i++) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright "Native LDAP lookup error=%d",
e8c27ec857e6e2db8c4fe56938b70a89b5bed9f3baban * AD lookups:
479ac37569625bae44ffb80071d4bc865fc710eddm * pid2sid:
479ac37569625bae44ffb80071d4bc865fc710eddm * - nldap or mixed mode. Got winname from nldap lookup.
479ac37569625bae44ffb80071d4bc865fc710eddm * winname2sid could not be resolved locally. Lookup AD
479ac37569625bae44ffb80071d4bc865fc710eddm * by winname to get sid.
479ac37569625bae44ffb80071d4bc865fc710eddm * - ad mode. Got unixname. Lookup AD by unixname to get
479ac37569625bae44ffb80071d4bc865fc710eddm * winname and sid.
479ac37569625bae44ffb80071d4bc865fc710eddm * sid2pid:
479ac37569625bae44ffb80071d4bc865fc710eddm * - ad or mixed mode. Lookup AD by sid or winname to get
479ac37569625bae44ffb80071d4bc865fc710eddm * winname, sid and unixname.
479ac37569625bae44ffb80071d4bc865fc710eddm * - any mode. Got either sid or winname but not both. Lookup
479ac37569625bae44ffb80071d4bc865fc710eddm * AD by sid or winname to get winname, sid.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright for (i = 0; i < batch.idmap_mapping_batch_len; i++) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright if (res->retcode == IDMAP_ERR_DOMAIN_NOTFOUND &&
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * If AD lookup failed Domain Not Found but
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * we have a winname and SID, it means that
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * - LSA succeeded
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * - it's a request a cross-forest trust
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * - we were looking for directory-based
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * mapping information.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * In that case, we're OK, just go on.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * If this seems more convoluted than it
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * should be, it is - really, we probably
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * shouldn't even be attempting AD lookups
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * in this situation, but that's a more
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * intricate cleanup that will have to wait
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright * for later.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright "AD lookup - domain not found (ignored)");
e8c27ec857e6e2db8c4fe56938b70a89b5bed9f3baban * native LDAP lookups:
479ac37569625bae44ffb80071d4bc865fc710eddm * sid2pid:
479ac37569625bae44ffb80071d4bc865fc710eddm * - nldap mode. Got winname and sid from AD lookup. Lookup nldap
479ac37569625bae44ffb80071d4bc865fc710eddm * by winname to get pid and unixname.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright TRACE(req, res, "Native LDAP lookup error=%d", retcode);
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright for (i = 0; i < batch.idmap_mapping_batch_len; i++) {
e8c27ec857e6e2db8c4fe56938b70a89b5bed9f3baban /* Reset 'done' flags */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Second stage */
e8c27ec857e6e2db8c4fe56938b70a89b5bed9f3baban /* First stage has already set the error */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Check if we are done */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw if (state.sid2pid_done == TRUE && state.pid2sid_done == TRUE)
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Reset our 'done' flags */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Update cache in a single transaction */
71590c90e239661c113497da3ca8b7301dfbe24cnw if (sql_exec_no_cb(cache, IDMAP_CACHENAME, "BEGIN TRANSACTION;")
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* Commit if we have at least one successful update */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw if (state.sid2pid_done == FALSE || state.pid2sid_done == FALSE)
71590c90e239661c113497da3ca8b7301dfbe24cnw "COMMIT TRANSACTION;");
71590c90e239661c113497da3ca8b7301dfbe24cnw "END TRANSACTION;");
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright for (i = 0; i < batch.idmap_mapping_batch_len; i++) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright for (i = 0; i < batch.idmap_mapping_batch_len; i++) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright if (!(req->flag & IDMAP_REQ_FLG_MAPPING_INFO) &&
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
cd37da7426f0c49c14ad9a8a07638ca971477566nwlist_mappings_cb(void *parg, int argc, char **argv, char **colnames)
cd37da7426f0c49c14ad9a8a07638ca971477566nw static int validated_column_names = 0;
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp _VALIDATE_LIST_CB_DATA(19, &result->mappings.mappings_val,
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (1);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw result->mappings.mappings_val[cb_data->next].id1.idmap_id_u.sid.prefix =
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw result->mappings.mappings_val[cb_data->next].id1.idmap_id_u.sid.rid =
cd37da7426f0c49c14ad9a8a07638ca971477566nw result->mappings.mappings_val[cb_data->next].id1.idtype =
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw result->mappings.mappings_val[cb_data->next].id2.idmap_id_u.uid =
cd37da7426f0c49c14ad9a8a07638ca971477566nw result->mappings.mappings_val[cb_data->next].id2.idtype =
651c0131ccc65381cbda174bee44a4fd7a518d6bbaban result->mappings.mappings_val[cb_data->next].direction =
651c0131ccc65381cbda174bee44a4fd7a518d6bbaban result->mappings.mappings_val[cb_data->next].direction =
651c0131ccc65381cbda174bee44a4fd7a518d6bbaban result->mappings.mappings_val[cb_data->next].direction =
8e22821528b08c6dba4e8176351560f316f6d0dedm STRDUP_OR_FAIL(result->mappings.mappings_val[cb_data->next].id1domain,
8e22821528b08c6dba4e8176351560f316f6d0dedm STRDUP_OR_FAIL(result->mappings.mappings_val[cb_data->next].id1name,
8e22821528b08c6dba4e8176351560f316f6d0dedm STRDUP_OR_FAIL(result->mappings.mappings_val[cb_data->next].id2name,
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp how = &result->mappings.mappings_val[cb_data->next].info.how;
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desai /* Unknown mapping type */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (0);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejpidmap_list_mappings_1_svc(int64_t lastrowid, uint64_t limit, int32_t flag,
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp /* Current time */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Get cache handle */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Create LIMIT expression. */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw (void) snprintf(rbuf, sizeof (rbuf), "rowid > %" PRIu64, lastrowid);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * Combine all the above into a giant SELECT statement that
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * will return the requested mappings
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp sql = sqlite_mprintf("SELECT rowid, sidprefix, rid, pid, w2u, "
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp "u2w, windomain, canon_winname, unixname, is_user, is_wuser, "
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp "map_type, map_dn, map_attr, map_value, map_windomain, "
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp "map_winname, map_unixname, map_is_nt4 "
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp "FROM idmap_cache WHERE %s AND "
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp "(pid >= 2147483648 OR (expiration = 0 OR "
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp "expiration ISNULL OR expiration > %d)) "
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Execute the SQL statement and update the return buffer */
71590c90e239661c113497da3ca8b7301dfbe24cnw PROCESS_LIST_SVC_SQL(retcode, cache, IDMAP_CACHENAME, sql, limit,
48258c6b4e17f36ab09fba0bd6307d1fec9dcbcejp flag, list_mappings_cb, result, result->mappings.mappings_len);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw (void) xdr_free(xdr_idmap_mappings_res, (caddr_t)result);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
cd37da7426f0c49c14ad9a8a07638ca971477566nwlist_namerules_cb(void *parg, int argc, char **argv, char **colnames)
cd37da7426f0c49c14ad9a8a07638ca971477566nw static int validated_column_names = 0;
8e22821528b08c6dba4e8176351560f316f6d0dedm STRDUP_OR_FAIL(result->rules.rules_val[cb_data->next].windomain,
8e22821528b08c6dba4e8176351560f316f6d0dedm STRDUP_OR_FAIL(result->rules.rules_val[cb_data->next].winname,
8e22821528b08c6dba4e8176351560f316f6d0dedm STRDUP_OR_FAIL(result->rules.rules_val[cb_data->next].unixname,
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (0);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwidmap_list_namerules_1_svc(idmap_namerule rule, uint64_t lastrowid,
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Get db handle */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Create LIMIT expression. */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw (void) snprintf(rbuf, sizeof (rbuf), "rowid > %" PRIu64, lastrowid);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * Combine all the above into a giant SELECT statement that
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw * will return the requested rules
cd37da7426f0c49c14ad9a8a07638ca971477566nw sql = sqlite_mprintf("SELECT rowid, is_user, is_wuser, windomain, "
cd37da7426f0c49c14ad9a8a07638ca971477566nw "winname_display, is_nt4, unixname, w2u_order, u2w_order "
cd37da7426f0c49c14ad9a8a07638ca971477566nw "FROM namerules WHERE "
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown " %s %s %s;",
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Execute the SQL statement and update the return buffer */
71590c90e239661c113497da3ca8b7301dfbe24cnw PROCESS_LIST_SVC_SQL(retcode, db, IDMAP_DBNAME, sql, limit,
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw (void) xdr_free(xdr_idmap_namerules_res, (caddr_t)result);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (-1);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (-1);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (-1);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (-1);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw return (1);
8e22821528b08c6dba4e8176351560f316f6d0dedm * Meaning of the return values is the following: For retcode ==
8e22821528b08c6dba4e8176351560f316f6d0dedm * IDMAP_SUCCESS, everything went OK and error_index is
8e22821528b08c6dba4e8176351560f316f6d0dedm * undefined. Otherwise, error_index >=0 shows the failed batch
8e22821528b08c6dba4e8176351560f316f6d0dedm * element. errro_index == -1 indicates failure at the beginning,
8e22821528b08c6dba4e8176351560f316f6d0dedm * error_index == -2 at the end.
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
8e22821528b08c6dba4e8176351560f316f6d0dedmidmap_update_1_svc(idmap_update_batch batch, idmap_update_res *res,
8e22821528b08c6dba4e8176351560f316f6d0dedm (void) memset(&res->error_rule, 0, sizeof (res->error_rule));
8e22821528b08c6dba4e8176351560f316f6d0dedm (void) memset(&res->conflict_rule, 0, sizeof (res->conflict_rule));
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw /* Get db handle */
71590c90e239661c113497da3ca8b7301dfbe24cnw res->retcode = sql_exec_no_cb(db, IDMAP_DBNAME, "BEGIN TRANSACTION;");
71590c90e239661c113497da3ca8b7301dfbe24cnw "COMMIT TRANSACTION;");
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (res->retcode == IDMAP_SUCCESS) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States /*
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * We've updated the rules. Expire the cache
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * so that existing mappings will be
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States * reconsidered.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States */
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States res->retcode =
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States idmap_cache_flush(IDMAP_FLUSH_EXPIRE);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States } else {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States }
71590c90e239661c113497da3ca8b7301dfbe24cnw "ROLLBACK TRANSACTION;");
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier to->idmap_id_u.sid.rid = from->idmap_id_u.sid.rid;
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier retcode = copy_string(&to->idmap_id_u.sid.prefix,
fe1c642d06e14b412cd83ae2179303186ab08972Bill Kriercopy_mapping(idmap_mapping *mapping, idmap_mapping *request)
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier retcode = copy_string(&mapping->id1domain, request->id1domain);
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier retcode = copy_string(&mapping->id1name, request->id1name);
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier retcode = copy_string(&mapping->id2domain, request->id2domain);
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier retcode = copy_string(&mapping->id2name, request->id2name);
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier /* Clear out things we might want to xdr_free on error */
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier (void) memset(&batch_result, 0, sizeof (batch_result));
0dcc71495bad040a0c83830efc85acf8d897350dnw result->retcode = validate_mapped_id_by_name_req(&request);
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * Copy the request. We need to modify it, and
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * what we have is a shallow copy. Freeing pointers from
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * our copy will lead to problems, since the RPC framework
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * has its own copy of those pointers. Besides, we need
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * a copy to return.
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * Set up to return the filled-in mapping structure.
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * Note that we xdr_free result on error, and that'll take
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier * care of freeing the mapping structure.
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier /* Set up for the request to the batch API */
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier /* Do the real work. */
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier /* Copy what we need out of the batch response */
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier result->retcode = copy_id(&map->id2, &batch_result.ids.ids_val[0].id);
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier map->direction = batch_result.ids.ids_val[0].direction;
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier result->retcode = batch_result.ids.ids_val[0].retcode;
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright idmap_info_mov(&map->info, &batch_result.ids.ids_val[0].info);
fe1c642d06e14b412cd83ae2179303186ab08972Bill Krier xdr_free(xdr_idmap_ids_res, (char *)&batch_result);
479ac37569625bae44ffb80071d4bc865fc710eddm/* ARGSUSED */
479ac37569625bae44ffb80071d4bc865fc710eddm /* Init */
479ac37569625bae44ffb80071d4bc865fc710eddm /* Just shortcuts: */
479ac37569625bae44ffb80071d4bc865fc710eddm result->value.idmap_prop_val_u.intval = pgcfg->list_size_limit;
4d61c878ad5fbf36c5338bef5994cc5fe88a589aJulian Pullen result->auto_discovered = pgcfg->domain_controller_auto_disc;
4d61c878ad5fbf36c5338bef5994cc5fe88a589aJulian Pullen result->auto_discovered = pgcfg->forest_name_auto_disc;
4d61c878ad5fbf36c5338bef5994cc5fe88a589aJulian Pullen result->auto_discovered = pgcfg->site_name_auto_disc;
4d61c878ad5fbf36c5338bef5994cc5fe88a589aJulian Pullen result->auto_discovered = pgcfg->global_catalog_auto_disc;
e3f2c991a8548408db0a2787bd8b43d5124821d3Keyur Desai STRDUP_CHECK(result->value.idmap_prop_val_u.utf8val,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesint
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesidmap_flush_1_svc(
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States idmap_flush_op op,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States idmap_retcode *result,
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States struct svc_req *rqstp)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States{
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States NOTE(ARGUNUSED(rqstp))
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (verify_rules_auth(rqstp) < 0) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States *result = IDMAP_ERR_PERMISSION_DENIED;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States return (TRUE);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States }
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States *result = idmap_cache_flush(op);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States return (TRUE);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States}
c5c4113dfcabb1eed3d4bdf7609de5170027a794nw/* ARGSUSED */
c5c4113dfcabb1eed3d4bdf7609de5170027a794nwidmap_prog_1_freeresult(SVCXPRT *transp, xdrproc_t xdr_result,
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * This function is called by rpc_svc.c when it encounters an error.