/* alpha_strcpy includes the space for the terminating nul. */
alpha_strcpy(local_machine,tmp_local_machine,
SAFE_NETBIOS_CHARS,len+1);
- strlower_m(local_machine);
+ if (!strlower_m(local_machine)) {
+ TALLOC_FREE(tmp_local_machine);
+ return false;
+ }
TALLOC_FREE(tmp_local_machine);
already_perm = perm;
/* alpha_strcpy includes the space for the terminating nul. */
alpha_strcpy(remote_machine,tmp_remote_machine,
SAFE_NETBIOS_CHARS,len+1);
- strlower_m(remote_machine);
+ if (!strlower_m(remote_machine)) {
+ TALLOC_FREE(tmp_remote_machine);
+ return false;
+ }
TALLOC_FREE(tmp_remote_machine);
already_perm = perm;
return;
}
trim_char(tmp, ' ', ' ');
- strlower_m(tmp);
+ if (!strlower_m(tmp)) {
+ TALLOC_FREE(tmp);
+ return;
+ }
len = strlen(tmp);
#if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
- if (lp_nis_home_map()) {
+ if (lp_nis_homedir()) {
const char *home_path_start;
char *automount_value = automount_lookup(ctx, user_name);
}
#if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
- if (lp_nis_home_map()) {
+ if (lp_nis_homedir()) {
char *p;
char *srv;
char *automount_value = automount_lookup(ctx, user_name);
break;
case 'G' : {
struct passwd *pass;
- r = talloc_strdup(tmp_ctx, smb_name);
+
+ if (domain_name != NULL && domain_name[0] != '\0') {
+ r = talloc_asprintf(tmp_ctx,
+ "%s%c%s",
+ domain_name,
+ *lp_winbind_separator(),
+ smb_name);
+ } else {
+ r = talloc_strdup(tmp_ctx, smb_name);
+ }
if (r == NULL) {
goto error;
}
+
pass = Get_Pwnam_alloc(tmp_ctx, r);
if (pass != NULL) {
a_string = realloc_string_sub(
get_remote_arch_str());
break;
case 'd' :
- slprintf(pidstr,sizeof(pidstr)-1, "%d",(int)sys_getpid());
+ slprintf(pidstr,sizeof(pidstr)-1, "%d",(int)getpid());
a_string = realloc_string_sub(a_string, "%d", pidstr);
break;
case 'h' :
char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
const char *input_string,
const char *username,
+ const char *grpname,
const char *domain,
uid_t uid,
gid_t gid)
break;
case 'G' :
if (gid != -1) {
- a_string = talloc_string_sub(
- tmp_ctx, a_string, "%G",
- gidtoname(gid));
+ const char *name;
+
+ if (grpname != NULL) {
+ name = grpname;
+ } else {
+ name = gidtoname(gid);
+ }
+
+ a_string = talloc_string_sub(tmp_ctx,
+ a_string,
+ "%G",
+ name);
} else {
a_string = talloc_string_sub(
tmp_ctx, a_string,
break;
case 'g' :
if (gid != -1) {
- a_string = talloc_string_sub(
- tmp_ctx, a_string, "%g",
- gidtoname(gid));
+ const char *name;
+
+ if (grpname != NULL) {
+ name = grpname;
+ } else {
+ name = gidtoname(gid);
+ }
+
+ a_string = talloc_string_sub(tmp_ctx,
+ a_string,
+ "%g",
+ name);
} else {
a_string = talloc_string_sub(
tmp_ctx, a_string, "%g", "NO_GROUP");