1 /*
2 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
4 */
5
6 /*
7 * BSD 3 Clause License
8 *
9 * Copyright (c) 2007, The Storage Networking Industry Association.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * - Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * - Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * - Neither the name of The Storage Networking Industry Association (SNIA)
23 * nor the names of its contributors may be used to endorse or promote
75 {"token-maxseq", "", 0, NDMP_CF_NOTINIT},
76 {"version", "", 0, NDMP_CF_NOTINIT},
77 {"restore-fullpath", "", 0, NDMP_CF_NOTINIT},
78 {"debug-path", "", 0, NDMP_CF_NOTINIT},
79 {"plugin-path", "", 0, NDMP_CF_NOTINIT},
80 {"socket-css", "", 0, NDMP_CF_NOTINIT},
81 {"socket-crs", "", 0, NDMP_CF_NOTINIT},
82 {"mover-recordsize", "", 0, NDMP_CF_NOTINIT},
83 {"restore-wildcard-enable", "", 0, NDMP_CF_NOTINIT},
84 {"cram-md5-username", "", 0, NDMP_CF_NOTINIT},
85 {"cram-md5-password", "", 0, NDMP_CF_NOTINIT},
86 {"cleartext-username", "", 0, NDMP_CF_NOTINIT},
87 {"cleartext-password", "", 0, NDMP_CF_NOTINIT},
88 {"tcp-port", "", 0, NDMP_CF_NOTINIT},
89 {"backup-quarantine", "", 0, NDMP_CF_NOTINIT},
90 {"restore-quarantine", "", 0, NDMP_CF_NOTINIT},
91 {"overwrite-quarantine", "", 0, NDMP_CF_NOTINIT},
92 {"zfs-force-override", "", 0, NDMP_CF_NOTINIT},
93 {"drive-type", "", 0, NDMP_CF_NOTINIT},
94 {"debug-mode", "", 0, NDMP_CF_NOTINIT},
95 };
96
97 /*
98 * Loads all the NDMP configuration parameters and sets up the
99 * config table.
100 */
101 int
102 ndmpd_load_prop(void)
103 {
104 ndmpd_cfg_id_t id;
105 ndmpd_cfg_param_t *cfg;
106 char *value;
107
108 for (id = 0; id < NDMP_MAXALL; id++) {
109 cfg = &ndmpd_cfg_table[id];
110 if ((ndmp_get_prop(cfg->sc_name, &value)) == -1) {
111 syslog(LOG_DEBUG, "%s %s",
112 cfg->sc_name, ndmp_strerror(ndmp_errno));
113 continue;
114 }
115 /*
116 * enval == 0 could mean two things, either the
117 * config param is not defined, or it has been
118 * removed. If the variable has already been defined
119 * and now enval is 0, it should be removed, otherwise
120 * we don't need to do anything in this case.
121 */
122 if ((cfg->sc_flags & NDMP_CF_DEFINED) || value) {
123 if (ndmpd_config_update(cfg, value)) {
124 free(value);
125 return (-1);
126 }
127 }
128 free(value);
129 }
130 return (0);
131 }
|
1 /*
2 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
4 */
5
6 /*
7 * BSD 3 Clause License
8 *
9 * Copyright (c) 2007, The Storage Networking Industry Association.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * - Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * - Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
20 * distribution.
21 *
22 * - Neither the name of The Storage Networking Industry Association (SNIA)
23 * nor the names of its contributors may be used to endorse or promote
75 {"token-maxseq", "", 0, NDMP_CF_NOTINIT},
76 {"version", "", 0, NDMP_CF_NOTINIT},
77 {"restore-fullpath", "", 0, NDMP_CF_NOTINIT},
78 {"debug-path", "", 0, NDMP_CF_NOTINIT},
79 {"plugin-path", "", 0, NDMP_CF_NOTINIT},
80 {"socket-css", "", 0, NDMP_CF_NOTINIT},
81 {"socket-crs", "", 0, NDMP_CF_NOTINIT},
82 {"mover-recordsize", "", 0, NDMP_CF_NOTINIT},
83 {"restore-wildcard-enable", "", 0, NDMP_CF_NOTINIT},
84 {"cram-md5-username", "", 0, NDMP_CF_NOTINIT},
85 {"cram-md5-password", "", 0, NDMP_CF_NOTINIT},
86 {"cleartext-username", "", 0, NDMP_CF_NOTINIT},
87 {"cleartext-password", "", 0, NDMP_CF_NOTINIT},
88 {"tcp-port", "", 0, NDMP_CF_NOTINIT},
89 {"backup-quarantine", "", 0, NDMP_CF_NOTINIT},
90 {"restore-quarantine", "", 0, NDMP_CF_NOTINIT},
91 {"overwrite-quarantine", "", 0, NDMP_CF_NOTINIT},
92 {"zfs-force-override", "", 0, NDMP_CF_NOTINIT},
93 {"drive-type", "", 0, NDMP_CF_NOTINIT},
94 {"debug-mode", "", 0, NDMP_CF_NOTINIT},
95 {"vendor-name", "", 0, NDMP_CF_NOTINIT},
96 {"product-name", "", 0, NDMP_CF_NOTINIT},
97 {"autosync-support", "", 0, NDMP_CF_NOTINIT},
98 {"hpr-support", "", 0, NDMP_CF_NOTINIT},
99 };
100
101 /*
102 * Loads all the NDMP configuration parameters and sets up the
103 * config table.
104 */
105 int
106 ndmpd_load_prop(void)
107 {
108 ndmpd_cfg_id_t id;
109 ndmpd_cfg_param_t *cfg;
110 char *value;
111
112 for (id = 0; id < NDMP_MAXALL; id++) {
113 cfg = &ndmpd_cfg_table[id];
114 if ((ndmp_get_prop(cfg->sc_name, &value)) == -1) {
115 syslog(LOG_ERR, "%s %s",
116 cfg->sc_name, ndmp_strerror(ndmp_errno));
117 continue;
118 }
119 /*
120 * enval == 0 could mean two things, either the
121 * config param is not defined, or it has been
122 * removed. If the variable has already been defined
123 * and now enval is 0, it should be removed, otherwise
124 * we don't need to do anything in this case.
125 */
126 if ((cfg->sc_flags & NDMP_CF_DEFINED) || value) {
127 if (ndmpd_config_update(cfg, value)) {
128 free(value);
129 return (-1);
130 }
131 }
132 free(value);
133 }
134 return (0);
135 }
|