| 36 | */ |
| 37 | |
| 38 | const char * /* O - Device URI or @code NULL@ */ |
| 39 | cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */ |
| 40 | { |
| 41 | const char *device_uri, /* Device URI */ |
| 42 | *auth_info_required; /* AUTH_INFO_REQUIRED env var */ |
| 43 | _cups_globals_t *cg = _cupsGlobals(); /* Global info */ |
| 44 | int options; /* Resolve options */ |
| 45 | ppd_file_t *ppd; /* PPD file */ |
| 46 | ppd_attr_t *ppdattr; /* PPD attribute */ |
| 47 | |
| 48 | |
| 49 | if ((device_uri = getenv("DEVICE_URI")) == NULL) |
| 50 | { |
| 51 | if (!argv || !argv[0] || !strchr(argv[0], ':')) |
| 52 | return (NULL); |
| 53 | |
| 54 | device_uri = argv[0]; |
| 55 | } |
| 56 | |
| 57 | options = _HTTP_RESOLVE_STDERR; |
| 58 | if ((auth_info_required = getenv("AUTH_INFO_REQUIRED")) != NULL && |
| 59 | !strcmp(auth_info_required, "negotiate")) |
| 60 | options |= _HTTP_RESOLVE_FQDN; |
| 61 | |
| 62 | if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL) |
| 63 | { |
| 64 | if ((ppdattr = ppdFindAttr(ppd, "cupsIPPFaxOut", NULL)) != NULL && |
| 65 | !_cups_strcasecmp(ppdattr->value, "true")) |
| 66 | options |= _HTTP_RESOLVE_FAXOUT; |
| 67 | |
| 68 | ppdClose(ppd); |
| 69 | } |
| 70 | |
| 71 | return (_httpResolveURI(device_uri, cg->resolved_uri, |
| 72 | sizeof(cg->resolved_uri), options, NULL, NULL)); |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /* |
no test coverage detected