/** * * print_fhandle_nlm * * This routine prints a NFSv3 file handle (for debugging purpose) * * @param fh [IN] file handle to print. * * @return nothing (void function). * */ void print_fhandle_nlm(log_components_t component, netobj *fh) { if(isFullDebug(component)) { char str[LEN_FH_STR]; sprint_fhandle_nlm(str, fh); LogFullDebug(component, "%s", str); } } /* print_fhandle_nlm */
bool_t nlm_block_data_to_fsal_context(state_block_data_t * block_data, fsal_op_context_t * fsal_context) { exportlist_t * pexport = NULL; short exportid; fsal_status_t fsal_status; state_nlm_block_data_t * nlm_block_data = &block_data->sbd_block_data.sbd_nlm_block_data; /* Get export ID from handle */ exportid = nlm4_FhandleToExportId(&nlm_block_data->sbd_nlm_fh); /* Get export matching export ID */ if(exportid < 0 || (pexport = nfs_Get_export_by_id(nfs_param.pexportlist, exportid)) == NULL || (pexport->export_perms.options & EXPORT_OPTION_NFSV3) == 0) { /* Reject the request for authentication reason (incompatible file handle) */ if(isInfo(COMPONENT_NLM)) { char dumpfh[1024]; char *reason; char addrbuf[SOCK_NAME_MAX]; sprint_sockaddr(&nlm_block_data->sbd_nlm_hostaddr, addrbuf, sizeof(addrbuf)); if(exportid < 0) reason = "has badly formed handle"; else if(pexport == NULL) reason = "has invalid export"; else reason = "V3 not allowed on this export"; sprint_fhandle_nlm(dumpfh, &nlm_block_data->sbd_nlm_fh); LogMajor(COMPONENT_NLM, "NLM4 granted lock from host %s %s, FH=%s", addrbuf, reason, dumpfh); } return FALSE; } LogFullDebug(COMPONENT_NLM, "Found export entry for path=%s as exportid=%d", pexport->fullpath, pexport->id); /* Build the credentials */ fsal_status = FSAL_GetClientContext(fsal_context, &pexport->FS_export_context, block_data->sbd_credential.user, block_data->sbd_credential.group, block_data->sbd_credential.alt_groups, block_data->sbd_credential.nbgroups); if(FSAL_IS_ERROR(fsal_status)) { LogEvent(COMPONENT_NLM, "Could not get credentials for (uid=%d,gid=%d), fsal error=(%d,%d)", block_data->sbd_credential.user, block_data->sbd_credential.group, fsal_status.major, fsal_status.minor); return FALSE; } else LogDebug(COMPONENT_NLM, "FSAL Cred acquired for (uid=%d,gid=%d)", block_data->sbd_credential.user, block_data->sbd_credential.group); return TRUE; }