| 2927 | */ |
| 2928 | |
| 2929 | const char * /* O - Printer or class name */ |
| 2930 | cupsdValidateDest( |
| 2931 | const char *uri, /* I - Printer URI */ |
| 2932 | cups_ptype_t *dtype, /* O - Type (printer or class) */ |
| 2933 | cupsd_printer_t **printer) /* O - Printer pointer */ |
| 2934 | { |
| 2935 | cupsd_printer_t *p; /* Current printer */ |
| 2936 | char localname[1024],/* Localized hostname */ |
| 2937 | *lptr, /* Pointer into localized hostname */ |
| 2938 | *sptr, /* Pointer into server name */ |
| 2939 | *rptr, /* Pointer into resource */ |
| 2940 | scheme[32], /* Scheme portion of URI */ |
| 2941 | username[64], /* Username portion of URI */ |
| 2942 | hostname[HTTP_MAX_HOST], |
| 2943 | /* Host portion of URI */ |
| 2944 | resource[HTTP_MAX_URI]; |
| 2945 | /* Resource portion of URI */ |
| 2946 | int port; /* Port portion of URI */ |
| 2947 | |
| 2948 | |
| 2949 | /* |
| 2950 | * Initialize return values... |
| 2951 | */ |
| 2952 | |
| 2953 | if (printer) |
| 2954 | *printer = NULL; |
| 2955 | |
| 2956 | if (dtype) |
| 2957 | *dtype = (cups_ptype_t)0; |
| 2958 | |
| 2959 | /* |
| 2960 | * Pull the hostname and resource from the URI... |
| 2961 | */ |
| 2962 | |
| 2963 | httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme), |
| 2964 | username, sizeof(username), hostname, sizeof(hostname), |
| 2965 | &port, resource, sizeof(resource)); |
| 2966 | |
| 2967 | /* |
| 2968 | * See if the resource is a class or printer... |
| 2969 | */ |
| 2970 | |
| 2971 | if (!strncmp(resource, "/classes/", 9)) |
| 2972 | { |
| 2973 | /* |
| 2974 | * Class... |
| 2975 | */ |
| 2976 | |
| 2977 | rptr = resource + 9; |
| 2978 | } |
| 2979 | else if (!strncmp(resource, "/printers/", 10)) |
| 2980 | { |
| 2981 | /* |
| 2982 | * Printer... |
| 2983 | */ |
| 2984 | |
| 2985 | rptr = resource + 10; |
| 2986 | } |
no test coverage detected