void create_cal_params(const char *inSAR, meta_parameters *meta, report_level_t level) { int ii, kk; struct dataset_sum_rec dssr; // Data set summary record double *noise; char sarName[512], *facilityStr, *processorStr, *error; ceos_description *ceos; meta->calibration = meta_calibration_init(); strcpy (sarName, inSAR); if (isCEOS(sarName, &error)) { // Check for the various processors get_dssr(sarName, &dssr); facilityStr = trim_spaces(dssr.fac_id); processorStr = trim_spaces(dssr.sys_id); ceos = get_ceos_description_ext(inSAR, REPORT_LEVEL_NONE, FALSE); if (strncmp(facilityStr , "ASF" , 3) == 0 && strncmp(processorStr, "FOCUS", 5) != 0 && ((meta->projection && meta->projection->type == SCANSAR_PROJECTION) || (meta->projection && (strcmp_case(meta->general->mode, "SWA") == 0 || strcmp_case(meta->general->mode, "SWB") == 0)) ) ) { // ASF internal processor (PP or SSP), ScanSar data asf_scansar_cal_params *asf = MALLOC(sizeof(asf_scansar_cal_params)); meta->calibration->type = asf_scansar_cal; meta->calibration->asf_scansar = asf; // Get values for calibration coefficients and LUT struct VRADDR rdr; // Radiometric data record get_raddr(sarName, &rdr); // hardcodings for not-yet-calibrated fields if (rdr.a[0] == -99.0 || rdr.a[1]==0.0 ) { asf->a0 = 1.1E4; asf->a1 = 2.2E-5; asf->a2 = 0.0; } else { asf->a0 = rdr.a[0]; asf->a1 = rdr.a[1]; asf->a2 = rdr.a[2]; } // Set the Noise Correction Vector to correct version if (strncmp(dssr.cal_params_file,"SSPSWB010.CALPARMS",18)==0) { asfPrintStatus("\n Substituting hardcoded noise vector sspswb010\n"); noise = sspswb010_noise_vec; } else if (strncmp(dssr.cal_params_file,"SSPSWB011.CALPARMS",18)==0) { asfPrintStatus("\n Substituting hardcoded noise vector sspswb011\n"); noise = sspswb011_noise_vec; } else if (strncmp(dssr.cal_params_file,"SSPSWB013.CALPARMS",18)==0) { asfPrintStatus("\n Substituting hardcoded noise vector sspswb013\n"); noise = sspswb013_noise_vec; } else if (strncmp(dssr.cal_params_file,"SSPSWB014.CALPARMS",18)==0) { asfPrintStatus("\n Substituting hardcoded noise vector sspswb014\n"); noise = sspswb014_noise_vec; } else if (strncmp(dssr.cal_params_file,"SSPSWB015.CALPARMS",18)==0) { asfPrintStatus("\n Substituting hardcoded noise vector sspswb015\n"); noise = sspswb015_noise_vec; } else if (strncmp(dssr.cal_params_file,"SSPSWB016.CALPARMS",18)==0) { asfPrintStatus("\n Substituting hardcoded noise vector sspswb016\n"); noise = sspswb015_noise_vec; // 16 and 15 were identical antenna patterns, only metadata fields were // changed, so the noise vector for 16 is the same and that for 15. JBN } else noise = rdr.noise; for (kk=0; kk<256; ++kk) asf->noise[kk] = noise[kk]; } else if (strncmp(facilityStr, "ASF", 3)== 0 && strncmp(processorStr, "FOCUS", 5) != 0) { // ASF internal processor (PP or SSP) (non-Scansar) asf_cal_params *asf = (asf_cal_params *) MALLOC(sizeof(asf_cal_params)); meta->calibration->type = asf_cal; meta->calibration->asf = asf; // Get values for calibration coefficients and LUT struct VRADDR rdr; // Radiometric data record get_raddr(sarName, &rdr); // hardcodings for not-yet-calibrated fields if (rdr.a[0] == -99.0 || rdr.a[1]==0.0 ) { asf->a0 = 1.1E4; asf->a1 = 2.2E-5; asf->a2 = 0.0; } else { asf->a0 = rdr.a[0]; asf->a1 = rdr.a[1]; asf->a2 = rdr.a[2]; } if (ceos->product == SLC && ceos->sensor == ERS && meta->general->radiometry > r_AMP && meta->general->radiometry < r_POWER) { asfPrintStatus("Applying calibration adjustment of x1.3 for SLC data." "\n"); asf->a1 *= 1.3; } // grab the noise vector for (kk=0; kk<256; ++kk) asf->noise[kk] = rdr.noise[kk]; asf->sample_count = meta->general->sample_count; } else if ((strncmp(facilityStr, "ASF", 3) == 0 && strncmp(dssr.sys_id, "FOCUS", 5) == 0) || (strncmp(facilityStr, "CDPF", 4) == 0 || strncmp(facilityStr, "RSI", 3) == 0 || ((strncmp(facilityStr, "CSTARS", 6) == 0 || strncmp(facilityStr, "TRNS", 4) == 0) && strncmp(dssr.mission_id, "RSAT", 4) == 0))) { // Radarsat style calibration rsat_cal_params *rsat = (rsat_cal_params *) MALLOC(sizeof(rsat_cal_params)); meta->calibration->type = rsat_cal; meta->calibration->rsat = rsat; rsat->slc = FALSE; rsat->focus = FALSE; if (strncmp(dssr.product_type, "SLANT RANGE COMPLEX", 19) == 0 || strncmp(dssr.product_type, "SPECIAL PRODUCT(SINGL-LOOK COMP)", 32) == 0) { rsat->slc = TRUE; } if (strncmp(dssr.sys_id, "FOCUS", 5) == 0) rsat->focus = TRUE; // Read lookup up table from radiometric data record struct RSI_VRADDR radr; get_rsi_raddr(sarName, &radr); rsat->n = radr.n_samp; //rsat->lut = (double *) MALLOC(sizeof(double) * rsat->n); for (ii=0; ii<rsat->n; ii++) { if (strncmp(dssr.sys_id, "FOCUS", 5) == 0) rsat->lut[ii] = radr.lookup_tab[0]; else rsat->lut[ii] = radr.lookup_tab[ii]; } rsat->samp_inc = radr.samp_inc; rsat->a3 = radr.offset; } else if (strncmp(facilityStr, "ES", 2) == 0 || strncmp(facilityStr, "D-PAF", 5) == 0 || strncmp(facilityStr, "I-PAF", 2) == 0 || strncmp(facilityStr, "Beijing", 7) == 0 || (strncmp(facilityStr, "CSTARS", 6) == 0 && (strncmp(dssr.mission_id, "E", 1) == 0 || strncmp(dssr.mission_id, "J", 1) == 0)) ) { // ESA style calibration esa_cal_params *esa = (esa_cal_params *) MALLOC(sizeof(esa_cal_params)); meta->calibration->type = esa_cal; meta->calibration->esa = esa; // Read calibration coefficient and reference incidence angle struct ESA_FACDR facdr; get_esa_facdr(sarName, &facdr); esa->k = facdr.abs_cal_const; esa->ref_incid = dssr.incident_ang; } else if (strncmp(facilityStr, "EOC", 3) == 0) { // ALOS processor struct alos_rad_data_rec ardr; // ALOS Radiometric Data record alos_cal_params *alos = (alos_cal_params *) MALLOC(sizeof(alos_cal_params)); meta->calibration->type = alos_cal; meta->calibration->alos = alos; // Determine beam mode int beam = dssr.ant_beam_num; int beam_count = dssr.nchn; if (beam >= 0 && beam <= 35 && beam_count == 2) beam += 36; // actually dual-pol data (HH+HV or VV+VH) else if (beam == 3 && beam_count == 4) beam = 127; // actually PLR 21.5 else if (beam_count == 1 && dssr.product_id[3] == 'S') { // some fine backwards engineering here to figure out the correct beam // number - off nadir angle and processing bandwidth required // don't care for the HH versus VV at the moment if (dssr.off_nadir_angle < 25.0) { if (dssr.bnd_rng < 20000.0) beam = 72; // WB1 HH3scan else beam = 73; // WB2 HH3scan } else if (dssr.off_nadir_angle > 25.0 && dssr.off_nadir_angle < 26.0) { if (dssr.off_nadir_angle < 25.0) { if (dssr.bnd_rng < 20000.0) beam = 76; // WB1 HH4scan else beam = 77; // WB2 HH4scan } } else { if (dssr.bnd_rng < 20000.0) beam = 80; // WB1 HH5scan else beam = 81; // WB2 HH5scan } } // Reading calibration coefficient get_ardr(sarName, &ardr); if (strncmp(dssr.lev_code, "1.1", 3) == 0) { // SLC // HH polarization if ((beam >= 0 && beam <= 17) || // FBS HH polarization (beam >= 36 && beam <= 53) || // FBD HH+HV polarization (beam >= 72 && beam <= 73) || // WB HH3scan (beam >= 76 && beam <= 77) || // WB HH4scan (beam >= 80 && beam <= 81) || // WB HH5scan (beam >= 84 && beam <= 101) || // DSN HH polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_hh = ardr.calibration_factor - 32; else alos->cf_hh = MAGIC_UNSET_DOUBLE; // HV polarization if ((beam >= 36 && beam <= 53) || // FBD HH+HV polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_hv = ardr.calibration_factor - 32; else alos->cf_hv = MAGIC_UNSET_DOUBLE; // VH polarization if ((beam >= 54 && beam <= 71) || // FBD VV+VH polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_vh = ardr.calibration_factor - 32; else alos->cf_vh = MAGIC_UNSET_DOUBLE; // VV polarization if ((beam >= 18 && beam <= 35) || // FBS VV polarization (beam >= 54 && beam <= 71) || // FBD VV+VH polarization (beam >= 74 && beam <= 75) || // WB VV3scan (beam >= 78 && beam <= 79) || // WB VV4scan (beam >= 82 && beam <= 83) || // WB VV5scan (beam >= 102 && beam <= 119) || // DSN VV polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_vv = ardr.calibration_factor - 32; else alos->cf_vv = MAGIC_UNSET_DOUBLE; } else if (strncmp(dssr.lev_code, "1.5", 3) == 0) { // regular detected // HH polarization if ((beam >= 0 && beam <= 17) || // FBS HH polarization (beam >= 36 && beam <= 53) || // FBD HH+HV polarization (beam >= 72 && beam <= 73) || // WB HH3scan (beam >= 76 && beam <= 77) || // WB HH4scan (beam >= 80 && beam <= 81) || // WB HH5scan (beam >= 84 && beam <= 101) || // DSN HH polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_hh = ardr.calibration_factor; else alos->cf_hh = MAGIC_UNSET_DOUBLE; // HV polarization if ((beam >= 36 && beam <= 53) || // FBD HH+HV polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_hv = ardr.calibration_factor; else alos->cf_hv = MAGIC_UNSET_DOUBLE; // VH polarization if ((beam >= 54 && beam <= 71) || // FBD VV+VH polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_vh = ardr.calibration_factor; else alos->cf_vh = MAGIC_UNSET_DOUBLE; // VV polarization if ((beam >= 18 && beam <= 35) || // FBS VV polarization (beam >= 54 && beam <= 71) || // FBD VV+VH polarization (beam >= 74 && beam <= 75) || // WB VV3scan (beam >= 78 && beam <= 79) || // WB VV4scan (beam >= 82 && beam <= 83) || // WB VV5scan (beam >= 102 && beam <= 119) || // DSN VV polarization (beam >= 120 && beam <= 131)) // PLR alos->cf_vv = ardr.calibration_factor; else alos->cf_vv = MAGIC_UNSET_DOUBLE; } // Check on processor version // Prior to processor version 9.02 some calibration parameters have been // determined again. double version; if (!get_alos_processor_version(inSAR, &version)) asfReport(level, "Could not find workreport file!\n" "Calibration parameters applied to the data might be " "inaccurate!\n"); else if (version < 9.02) { char str[512]; switch (beam) { case 0: alos->cf_hh = -83.16; // FBS 9.9 HH sprintf(str, "HH: %.2lf\n", alos->cf_hh); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) alos->cf_hh -= 32; break; case 3: alos->cf_hh = -83.55; // FBS 21.5 HH sprintf(str, "HH: %.2lf\n", alos->cf_hh); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) alos->cf_hh -= 32; break; case 7: alos->cf_hh = -83.40; // FBS 34.3 HH sprintf(str, "HH: %.2lf\n", alos->cf_hh); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) alos->cf_hh -= 32; break; case 10: alos->cf_hh = -83.65; // FBS 41.5 HH sprintf(str, "HH: %.2lf\n", alos->cf_hh); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) alos->cf_hh -= 32; break; case 35: alos->cf_hh = -83.30; // FBS 50.8 HH sprintf(str, "HH: %.2lf\n", alos->cf_hh); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) alos->cf_hh -= 32; break; case 43: alos->cf_hh = -83.20; // FBD 34.3 HH alos->cf_hv = -80.20; // FBD 34.3 HV sprintf(str, "HH: %.2lf\nHV: %.2lf\n", alos->cf_hh, alos->cf_hv); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) { alos->cf_hh -= 32; alos->cf_hv -= 32; } break; case 46: alos->cf_hh = -83.19; // FBD 41.5 HH alos->cf_hv = -80.19; // FBD 41.5 HV sprintf(str, "HH: %.2lf\nHV: %.2lf\n", alos->cf_hh, alos->cf_hv); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) { alos->cf_hh -= 32; alos->cf_hv -= 32; } break; case 127: alos->cf_hh = -83.40; // PLR 21.5 HH alos->cf_hv = -83.40; // PLR 21.5 HV alos->cf_vh = -83.40; // PLR 21.5 VH alos->cf_vv = -83.40; // PLR 21.5 VV sprintf(str, "HH: %.2lf\nHV: %.2lf\nVH: %.2lf\nVV: %.2lf", alos->cf_hh, alos->cf_hv, alos->cf_vh, alos->cf_vv); recalibration(str, level); if (strncmp(dssr.lev_code, "1.1", 3) == 0) { alos->cf_hh -= 32; alos->cf_hv -= 32; alos->cf_vh -= 32; alos->cf_vv -= 32; } break; } } } } else if (isTerrasar(sarName, &error)) { // TSX style calibration tsx_cal_params *tsx = (tsx_cal_params *) MALLOC(sizeof(tsx_cal_params)); meta->calibration->type = tsx_cal; meta->calibration->tsx = tsx; terrasar_meta *terrasar = read_terrasar_meta(sarName); tsx->k = terrasar->cal_factor; // calibration factor in beta naught FREE(terrasar); } else // should never get here asfPrintWarning("Unknown calibration parameter scheme!\n"); }
int nfs4_op_exchange_id(struct nfs_argop4 *op, compound_data_t *data, struct nfs_resop4 *resp) { nfs_client_record_t *client_record; nfs_client_id_t *conf; nfs_client_id_t *unconf; int rc; int len; char *temp; bool update; EXCHANGE_ID4args * const arg_EXCHANGE_ID4 = &op->nfs_argop4_u.opexchange_id; EXCHANGE_ID4res * const res_EXCHANGE_ID4 = &resp->nfs_resop4_u.opexchange_id; EXCHANGE_ID4resok * const res_EXCHANGE_ID4_ok = (&resp->nfs_resop4_u.opexchange_id.EXCHANGE_ID4res_u.eir_resok4); uint32_t pnfs_flags; in_addr_t server_addr = 0; resp->resop = NFS4_OP_EXCHANGE_ID; if (data->minorversion == 0) return res_EXCHANGE_ID4->eir_status = NFS4ERR_INVAL; if ((arg_EXCHANGE_ID4-> eia_flags & ~(EXCHGID4_FLAG_SUPP_MOVED_REFER | EXCHGID4_FLAG_SUPP_MOVED_MIGR | EXCHGID4_FLAG_BIND_PRINC_STATEID | EXCHGID4_FLAG_USE_NON_PNFS | EXCHGID4_FLAG_USE_PNFS_MDS | EXCHGID4_FLAG_USE_PNFS_DS | EXCHGID4_FLAG_UPD_CONFIRMED_REC_A | EXCHGID4_FLAG_CONFIRMED_R)) != 0) return res_EXCHANGE_ID4->eir_status = NFS4ERR_INVAL; /* If client did not ask for pNFS related server roles than just set server roles */ pnfs_flags = arg_EXCHANGE_ID4->eia_flags & EXCHGID4_FLAG_MASK_PNFS; if (pnfs_flags == 0) { if (nfs_param.nfsv4_param.pnfs_mds) pnfs_flags |= EXCHGID4_FLAG_USE_PNFS_MDS; if (nfs_param.nfsv4_param.pnfs_ds) pnfs_flags |= EXCHGID4_FLAG_USE_PNFS_DS; if (pnfs_flags == 0) pnfs_flags |= EXCHGID4_FLAG_USE_NON_PNFS; } /* If client did ask for pNFS related server roles than try to match the server roles to the client request. */ else { if ((arg_EXCHANGE_ID4->eia_flags & EXCHGID4_FLAG_USE_PNFS_MDS) && (nfs_param.nfsv4_param.pnfs_mds)) pnfs_flags |= EXCHGID4_FLAG_USE_PNFS_MDS; if ((arg_EXCHANGE_ID4->eia_flags & EXCHGID4_FLAG_USE_PNFS_DS) && (nfs_param.nfsv4_param.pnfs_ds)) pnfs_flags |= EXCHGID4_FLAG_USE_PNFS_DS; if (pnfs_flags == 0) pnfs_flags |= EXCHGID4_FLAG_USE_NON_PNFS; } LogDebug(COMPONENT_CLIENTID, "EXCHANGE_ID pnfs_flags 0x%08x eia_flags 0x%08x", pnfs_flags, arg_EXCHANGE_ID4->eia_flags); update = (arg_EXCHANGE_ID4->eia_flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A) != 0; server_addr = get_raddr(data->req->rq_xprt); /* Do we already have one or more records for client id (x)? */ client_record = get_client_record(arg_EXCHANGE_ID4->eia_clientowner.co_ownerid. co_ownerid_val, arg_EXCHANGE_ID4->eia_clientowner.co_ownerid. co_ownerid_len, pnfs_flags, server_addr); if (client_record == NULL) { /* Some major failure */ LogCrit(COMPONENT_CLIENTID, "EXCHANGE_ID failed"); res_EXCHANGE_ID4->eir_status = NFS4ERR_SERVERFAULT; return res_EXCHANGE_ID4->eir_status; } /* * The following checks are based on RFC5661 * * This attempts to implement the logic described in * 18.35.4. IMPLEMENTATION */ PTHREAD_MUTEX_lock(&client_record->cr_mutex); conf = client_record->cr_confirmed_rec; if (conf != NULL) { /* Need a reference to the confirmed record for below */ inc_client_id_ref(conf); } if (conf != NULL && !update) { /* EXCHGID4_FLAG_UPD_CONFIRMED_REC_A not set * * Compare the client credentials, but don't compare * the client address. Doing so interferes with * trunking and the ability of a client to reconnect * after being assigned a new address. */ if (!nfs_compare_clientcred(&conf->cid_credential, &data->credential)) { PTHREAD_MUTEX_lock(&conf->cid_mutex); if (!valid_lease(conf) || !client_id_has_state(conf)) { PTHREAD_MUTEX_unlock(&conf->cid_mutex); /* CASE 3, client collisions, old * clientid is expired * * Expire clientid and release our reference. */ nfs_client_id_expire(conf, false); dec_client_id_ref(conf); conf = NULL; } else { PTHREAD_MUTEX_unlock(&conf->cid_mutex); /* CASE 3, client collisions, old * clientid is not expired */ res_EXCHANGE_ID4->eir_status = NFS4ERR_CLID_INUSE; /* Release our reference to the * confirmed clientid. */ dec_client_id_ref(conf); goto out; } } else if (memcmp(arg_EXCHANGE_ID4->eia_clientowner.co_verifier, conf->cid_incoming_verifier, NFS4_VERIFIER_SIZE) == 0) { /* CASE 2, Non-Update on Existing Client ID * * Return what was last returned without * changing any refcounts */ unconf = conf; res_EXCHANGE_ID4_ok->eir_flags |= EXCHGID4_FLAG_CONFIRMED_R; goto return_ok; } else { /* CASE 5, client restart */ /** @todo FSF: expire old clientid? */ } } else if (conf != NULL) { /* EXCHGID4_FLAG_UPD_CONFIRMED_REC_A set */ if (memcmp(arg_EXCHANGE_ID4->eia_clientowner.co_verifier, conf->cid_incoming_verifier, NFS4_VERIFIER_SIZE) == 0) { if (!nfs_compare_clientcred(&conf->cid_credential, &data->credential) || op_ctx->client == NULL || conf->gsh_client == NULL || op_ctx->client != conf->gsh_client) { /* CASE 9, Update but wrong principal */ res_EXCHANGE_ID4->eir_status = NFS4ERR_PERM; } else { /* CASE 6, Update */ /** @todo: this is not implemented, the things it updates aren't even tracked */ LogMajor(COMPONENT_CLIENTID, "EXCHANGE_ID Update not supported"); res_EXCHANGE_ID4->eir_status = NFS4ERR_NOTSUPP; } } else { /* CASE 8, Update but wrong verifier */ res_EXCHANGE_ID4->eir_status = NFS4ERR_NOT_SAME; } /* Release our reference to the confirmed clientid. */ dec_client_id_ref(conf); goto out; } else if (conf == NULL && update) { res_EXCHANGE_ID4->eir_status = NFS4ERR_NOENT; goto out; } /* At this point, no matter what the case was above, we should * remove any pre-existing unconfirmed record. */ unconf = client_record->cr_unconfirmed_rec; if (unconf != NULL) { /* CASE 4, replacement of unconfirmed record * * Delete the unconfirmed clientid record * unhash the clientid record */ remove_unconfirmed_client_id(unconf); } /* Now we can proceed to build the new unconfirmed record. We * have determined the clientid and setclientid_confirm values * above. */ unconf = create_client_id(0, client_record, &data->credential, data->minorversion); if (unconf == NULL) { /* Error already logged, return */ res_EXCHANGE_ID4->eir_status = NFS4ERR_RESOURCE; goto out; } unconf->cid_create_session_sequence = 1; glist_init(&unconf->cid_cb.v41.cb_session_list); memcpy(unconf->cid_incoming_verifier, arg_EXCHANGE_ID4->eia_clientowner.co_verifier, NFS4_VERIFIER_SIZE); if (gethostname(unconf->cid_server_owner, sizeof(unconf->cid_server_owner)) == -1) { /* Free the clientid record and return */ free_client_id(unconf); res_EXCHANGE_ID4->eir_status = NFS4ERR_SERVERFAULT; goto out; } snprintf(unconf->cid_server_scope, sizeof(unconf->cid_server_scope), "%s_NFS-Ganesha", unconf->cid_server_owner); LogDebug(COMPONENT_CLIENTID, "Serving IP %s", unconf->cid_server_scope); rc = nfs_client_id_insert(unconf); if (rc != CLIENT_ID_SUCCESS) { /* Record is already freed, return. */ res_EXCHANGE_ID4->eir_status = clientid_error_to_nfsstat(rc); goto out; } return_ok: /* Build the reply */ res_EXCHANGE_ID4_ok->eir_clientid = unconf->cid_clientid; res_EXCHANGE_ID4_ok->eir_sequenceid = unconf->cid_create_session_sequence; res_EXCHANGE_ID4_ok->eir_flags |= client_record->cr_pnfs_flags; res_EXCHANGE_ID4_ok->eir_flags |= EXCHGID4_FLAG_SUPP_MOVED_REFER; res_EXCHANGE_ID4_ok->eir_state_protect.spr_how = SP4_NONE; len = strlen(unconf->cid_server_owner); temp = gsh_malloc(len); if (temp == NULL) { /** @todo FSF: not the best way to handle this but keeps from crashing */ len = 0; } else memcpy(temp, unconf->cid_server_owner, len); res_EXCHANGE_ID4_ok->eir_server_owner.so_major_id.so_major_id_len = len; res_EXCHANGE_ID4_ok->eir_server_owner.so_major_id.so_major_id_val = temp; res_EXCHANGE_ID4_ok->eir_server_owner.so_minor_id = 0; len = strlen(unconf->cid_server_scope); temp = gsh_malloc(len); if (temp == NULL) { /** @todo FSF: not the best way to handle this but keeps from crashing */ len = 0; } else memcpy(temp, unconf->cid_server_scope, len); res_EXCHANGE_ID4_ok->eir_server_scope.eir_server_scope_len = len; res_EXCHANGE_ID4_ok->eir_server_scope.eir_server_scope_val = temp; res_EXCHANGE_ID4_ok->eir_server_impl_id.eir_server_impl_id_len = 0; res_EXCHANGE_ID4_ok->eir_server_impl_id.eir_server_impl_id_val = NULL; res_EXCHANGE_ID4->eir_status = NFS4_OK; out: PTHREAD_MUTEX_unlock(&client_record->cr_mutex); /* Release our reference to the client record */ dec_client_record_ref(client_record); return res_EXCHANGE_ID4->eir_status; }