| 410 | */ |
| 411 | |
| 412 | int /* O - 1 on success, 0 on failure */ |
| 413 | cupsAdminSetServerSettings( |
| 414 | http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */ |
| 415 | int num_settings, /* I - Number of settings */ |
| 416 | cups_option_t *settings) /* I - Settings */ |
| 417 | { |
| 418 | int i; /* Looping var */ |
| 419 | http_status_t status; /* GET/PUT status */ |
| 420 | const char *server_port_env; /* SERVER_PORT env var */ |
| 421 | int server_port; /* IPP port for server */ |
| 422 | cups_file_t *cupsd; /* cupsd.conf file */ |
| 423 | char cupsdconf[1024]; /* cupsd.conf filename */ |
| 424 | int remote; /* Remote cupsd.conf file? */ |
| 425 | char tempfile[1024]; /* Temporary new cupsd.conf */ |
| 426 | cups_file_t *temp; /* Temporary file */ |
| 427 | char line[1024], /* Line from cupsd.conf file */ |
| 428 | *value; /* Value on line */ |
| 429 | int linenum, /* Line number in file */ |
| 430 | in_location, /* In a location section? */ |
| 431 | in_policy, /* In a policy section? */ |
| 432 | in_default_policy, /* In the default policy section? */ |
| 433 | in_cancel_job, /* In a cancel-job section? */ |
| 434 | in_admin_location, /* In the /admin location? */ |
| 435 | in_conf_location, /* In the /admin/conf location? */ |
| 436 | in_log_location, /* In the /admin/log location? */ |
| 437 | in_root_location; /* In the / location? */ |
| 438 | const char *val; /* Setting value */ |
| 439 | int share_printers, /* Share local printers */ |
| 440 | remote_admin, /* Remote administration allowed? */ |
| 441 | remote_any, /* Remote access from anywhere? */ |
| 442 | user_cancel_any, /* Cancel-job policy set? */ |
| 443 | debug_logging; /* LogLevel debug set? */ |
| 444 | int wrote_port_listen, /* Wrote the port/listen lines? */ |
| 445 | wrote_browsing, /* Wrote the browsing lines? */ |
| 446 | wrote_policy, /* Wrote the policy? */ |
| 447 | wrote_loglevel, /* Wrote the LogLevel line? */ |
| 448 | wrote_admin_location, /* Wrote the /admin location? */ |
| 449 | wrote_conf_location, /* Wrote the /admin/conf location? */ |
| 450 | wrote_log_location, /* Wrote the /admin/log location? */ |
| 451 | wrote_root_location; /* Wrote the / location? */ |
| 452 | int indent; /* Indentation */ |
| 453 | int cupsd_num_settings; /* New number of settings */ |
| 454 | int old_share_printers, /* Share local printers */ |
| 455 | old_remote_admin, /* Remote administration allowed? */ |
| 456 | old_remote_any, /* Remote access from anywhere? */ |
| 457 | old_user_cancel_any, /* Cancel-job policy set? */ |
| 458 | old_debug_logging; /* LogLevel debug set? */ |
| 459 | cups_option_t *cupsd_settings, /* New settings */ |
| 460 | *setting; /* Current setting */ |
| 461 | _cups_globals_t *cg = _cupsGlobals(); /* Global data */ |
| 462 | |
| 463 | |
| 464 | /* |
| 465 | * Range check input... |
| 466 | */ |
| 467 | |
| 468 | if (!http) |
| 469 | http = _cupsConnect(); |