Lines Matching refs:sctx

447     struct seed_ctx *sctx = NULL;
480 sctx = talloc_zero(tmp_ctx, struct seed_ctx);
481 if (sctx == NULL) {
487 sctx->uctx = talloc_zero(sctx, struct user_ctx);
488 if (sctx->uctx == NULL) {
517 sctx->interact = true;
540 sctx->uctx->domain_name = talloc_strdup(sctx->uctx, pc_domain);
541 if (sctx->uctx->domain_name == NULL) {
546 sctx->uctx->name = sss_create_internal_fqname(sctx->uctx,
548 if (sctx->uctx->name == NULL) {
558 sctx->uctx->uid = pc_uid;
559 sctx->uctx->gid = pc_gid;
561 sctx->uctx->gecos = talloc_strdup(sctx->uctx, pc_gecos);
562 if (sctx->uctx->gecos == NULL) {
568 sctx->uctx->home = talloc_strdup(sctx->uctx, pc_home);
569 if (sctx->uctx->home == NULL) {
575 sctx->uctx->shell = talloc_strdup(sctx->uctx, pc_shell);
576 if (sctx->uctx->shell == NULL) {
584 sctx->password_file = talloc_strdup(sctx, pc_password_file);
585 if (sctx->password_file == NULL) {
589 sctx->password_method = PASS_FILE;
591 sctx->password_method = PASS_PROMPT;
594 *_sctx = talloc_steal(mem_ctx, sctx);
721 static int seed_cache_user(struct seed_ctx *sctx)
727 ret = sysdb_transaction_start(sctx->sysdb);
735 if (sctx->user_cached == false) {
736 ret = sysdb_add_user(sctx->domain, sctx->uctx->name,
737 sctx->uctx->uid, sctx->uctx->gid,
738 sctx->uctx->gecos, sctx->uctx->home,
739 sctx->uctx->shell, NULL, NULL, 0, 0);
749 ret = sysdb_cache_password(sctx->domain, sctx->uctx->name,
750 sctx->uctx->password);
758 ret = sysdb_transaction_commit(sctx->sysdb);
768 sret = sysdb_transaction_cancel(sctx->sysdb);
779 struct seed_ctx *sctx = NULL;
784 ret = seed_init(sctx, argc, argv, &sctx);
792 ret = seed_init_db(sctx, sctx->uctx->domain_name, &sctx->confdb,
793 &sctx->domain, &sctx->sysdb);
800 ret = seed_domain_user_info(sctx->uctx->name, sctx->uctx->domain_name,
801 sctx->domain, &sctx->user_cached);
804 sctx->uctx->name, sctx->uctx->domain_name);
808 if (sctx->interact == true) {
809 if (sctx->user_cached == true) {
814 ret = seed_interactive_input(sctx, sctx->uctx, &input_uctx);
820 talloc_zfree(sctx->uctx);
821 sctx->uctx = input_uctx;
825 if (sctx->user_cached == false) {
826 if (sctx->uctx->uid == 0 || sctx->uctx->gid == 0) {
836 if (sctx->password_method == PASS_FILE) {
837 ret = seed_password_input_file(sctx->uctx, sctx->password_file,
838 &sctx->uctx->password);
844 ret = seed_password_input_prompt(sctx->uctx, &sctx->uctx->password);
852 ret = seed_cache_user(sctx);
857 if (sctx->user_cached == false) {
858 printf(_("User cache entry created for %1$s\n"), sctx->uctx->name);
861 sctx->uctx->name);
865 talloc_zfree(sctx);