Changeset 988 for vendor/current/lib/smbconf
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/lib/smbconf
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/smbconf/smbconf.c
r740 r988 232 232 233 233 /** 234 * create and set the definition for a new share (service). 235 */ 236 sbcErr smbconf_create_set_share(struct smbconf_ctx *ctx, 237 struct smbconf_service *service) 238 { 239 sbcErr err, err2; 240 int i; 241 uint32_t num_includes = 0; 242 char **includes = NULL; 243 TALLOC_CTX *tmp_ctx = NULL; 244 245 if ((service->name != NULL) && smbconf_share_exists(ctx, service->name)) 246 { 247 return SBC_ERR_FILE_EXISTS; 248 } 249 250 err = smbconf_transaction_start(ctx); 251 if (!SBC_ERROR_IS_OK(err)) { 252 return err; 253 } 254 255 tmp_ctx = talloc_stackframe(); 256 257 err = smbconf_create_share(ctx, service->name); 258 if (!SBC_ERROR_IS_OK(err)) { 259 goto cancel; 260 } 261 262 for (i = 0; i < service->num_params; i++) { 263 if (strequal(service->param_names[i], "include")) { 264 includes = talloc_realloc(tmp_ctx, includes, char *, 265 num_includes+1); 266 if (includes == NULL) { 267 err = SBC_ERR_NOMEM; 268 goto cancel; 269 } 270 includes[num_includes] = talloc_strdup(includes, 271 service->param_values[i]); 272 if (includes[num_includes] == NULL) { 273 err = SBC_ERR_NOMEM; 274 goto cancel; 275 } 276 num_includes++; 277 } else { 278 err = smbconf_set_parameter(ctx, 279 service->name, 280 service->param_names[i], 281 service->param_values[i]); 282 if (!SBC_ERROR_IS_OK(err)) { 283 goto cancel; 284 } 285 } 286 } 287 288 err = smbconf_set_includes(ctx, service->name, num_includes, 289 discard_const_p(const char *, includes)); 290 if (!SBC_ERROR_IS_OK(err)) { 291 goto cancel; 292 } 293 294 err = smbconf_transaction_commit(ctx); 295 296 goto done; 297 298 cancel: 299 err2 = smbconf_transaction_cancel(ctx); 300 if (!SBC_ERROR_IS_OK(err2)) { 301 DEBUG(5, (__location__ ": Error cancelling transaction: %s\n", 302 sbcErrorString(err2))); 303 } 304 305 done: 306 talloc_free(tmp_ctx); 307 return err; 308 } 309 310 /** 234 311 * get a definition of a share (service) from configuration. 235 312 */ -
vendor/current/lib/smbconf/smbconf.h
r740 r988 206 206 207 207 /** 208 * @brief create and set the definition for a new service. 209 * 210 * @param[in] ctx The smbconf context to use. 211 * 212 * @param[in] service The definition for the added service. 213 * 214 * @return SBC_ERR_OK on success, a corresponding sbcErr if an 215 * error occured. 216 */ 217 sbcErr smbconf_create_set_share(struct smbconf_ctx *ctx, 218 struct smbconf_service *service); 219 220 /** 208 221 * @brief Get a definition of a share (service) from configuration. 209 222 * … … 448 461 * @brief Start a transaction on the configuration backend. 449 462 * 450 * This is to speed up writes to the registry based backend. 463 * Transactions are exposed in order to make it possible 464 * to create atomic compound writing commands. 451 465 * 452 466 * @param[in] ctx The smbconf context to start the transaction. … … 460 474 * @brief Commit a transaction on the configuration backend. 461 475 * 462 * This is to speed up writes to the registry based backend. 476 * Transactions are exposed in order to make it possible 477 * to create atomic compound writing commands. 463 478 * 464 479 * @param[in] ctx The smbconf context to commit the transaction. … … 474 489 * @brief Cancel a transaction on the configuration backend. 475 490 * 491 * Transactions are exposed in order to make it possible 492 * to create atomic compound writing commands. 493 * 476 494 * @param[in] ctx The smbconf context to cancel the transaction. 477 495 * -
vendor/current/lib/smbconf/wscript_build
r740 r988 1 #!/usr/bin/env python2 3 1 bld.SAMBA_SUBSYSTEM('LIBSMBCONF', 4 2 source='smbconf.c smbconf_txt.c smbconf_util.c',
Note:
See TracChangeset
for help on using the changeset viewer.