summaryrefslogtreecommitdiff
path: root/libshouldbeinlibc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-10-20 08:38:41 +0000
committerRoland McGrath <roland@gnu.org>1998-10-20 08:38:41 +0000
commitfc40a731d23f893be2cb7699d7e078568d4c210c (patch)
tree9f1c90570e03a7c4082bee3fca2ced1755ac98a0 /libshouldbeinlibc
parent6b0d5d23a26adea266903f285f7424a2f93863cb (diff)
Add braces to silence gcc warnings.
Diffstat (limited to 'libshouldbeinlibc')
-rw-r--r--libshouldbeinlibc/ChangeLog12
-rw-r--r--libshouldbeinlibc/exec-reauth.c16
-rw-r--r--libshouldbeinlibc/idvec-rep.c18
-rw-r--r--libshouldbeinlibc/idvec-verify.c46
-rw-r--r--libshouldbeinlibc/portinfo.c26
-rw-r--r--libshouldbeinlibc/ugids-verify-auth.c66
6 files changed, 104 insertions, 80 deletions
diff --git a/libshouldbeinlibc/ChangeLog b/libshouldbeinlibc/ChangeLog
index be8b3fcb..ba9679cd 100644
--- a/libshouldbeinlibc/ChangeLog
+++ b/libshouldbeinlibc/ChangeLog
@@ -1,3 +1,15 @@
+1998-10-20 Roland McGrath <roland@baalperazim.frob.com>
+
+ * idvec-verify.c (verify_id): Add braces to silence gcc warning.
+
+1998-10-19 Roland McGrath <roland@baalperazim.frob.com>
+
+ * exec-reauth.c (exec_reauth): Add braces to silence gcc warning.
+ * idvec-rep.c (idvec_rep): Likewise.
+ * idvec-verify.c (verify_id): Likewise.
+ * portinfo.c (print_port_info): Likewise.
+ * ugids-verify-auth.c (ugids_verify_make_auth): Likewise.
+
1998-09-04 Roland McGrath <roland@baalperazim.frob.com>
* ugids-verify-auth.c (ugids_verify_make_auth): Fix typos in
diff --git a/libshouldbeinlibc/exec-reauth.c b/libshouldbeinlibc/exec-reauth.c
index 2b068684..1ddfcefa 100644
--- a/libshouldbeinlibc/exec-reauth.c
+++ b/libshouldbeinlibc/exec-reauth.c
@@ -1,6 +1,6 @@
/* Re-authentication in preparation for an exec
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 96, 98 Free Software Foundation, Inc.
Stolen by Miles Bader <miles@gnu.ai.mit.edu>, but really
written by Michael I. Bushnell p/BSG <mib@gnu.ai.mit.edu>
@@ -77,18 +77,20 @@ exec_reauth (auth_t auth, int secure, int must_reauth,
}
return 0;
}
-
+
/* Re-authenticate all the ports we are handing to the user
with this new port, and install the new auth port in ports. */
for (i = 0; i < num_fds && !err; ++i)
err = reauth (&fds[i], 0);
if (!err)
- if (secure)
- /* Not worth doing; the exec server will just do it again. */
- ports[INIT_PORT_CRDIR] = MACH_PORT_NULL;
- else
- err = reauth (&ports[INIT_PORT_CRDIR], 0);
+ {
+ if (secure)
+ /* Not worth doing; the exec server will just do it again. */
+ ports[INIT_PORT_CRDIR] = MACH_PORT_NULL;
+ else
+ err = reauth (&ports[INIT_PORT_CRDIR], 0);
+ }
if (!err)
err = reauth (&ports[INIT_PORT_PROC], 1);
if (!err)
diff --git a/libshouldbeinlibc/idvec-rep.c b/libshouldbeinlibc/idvec-rep.c
index 2fa1be03..b20e58ca 100644
--- a/libshouldbeinlibc/idvec-rep.c
+++ b/libshouldbeinlibc/idvec-rep.c
@@ -1,6 +1,6 @@
/* idvec string representation
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -95,13 +95,15 @@ idvec_rep (const struct idvec *idvec, int show_values, int show_names,
uid_t val = idvec->ids[i];
if (i > 0)
- if (ensure_room (sep_len))
- {
- strcpy (rep + rep_len, sep);
- rep_len += sep_len;
- }
- else
- break;
+ {
+ if (ensure_room (sep_len))
+ {
+ strcpy (rep + rep_len, sep);
+ rep_len += sep_len;
+ }
+ else
+ break;
+ }
if (show_names || !show_values)
name = (*id_name_fn) (val);
diff --git a/libshouldbeinlibc/idvec-verify.c b/libshouldbeinlibc/idvec-verify.c
index 7cd8b9a5..11ab2c22 100644
--- a/libshouldbeinlibc/idvec-verify.c
+++ b/libshouldbeinlibc/idvec-verify.c
@@ -1,6 +1,6 @@
/* Verify user passwords
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -260,19 +260,21 @@ verify_id (uid_t id, int is_group, int multiple,
}
}
if (! name)
- /* [ug]id lookup failed! */
- if (id != 0 || is_group)
- /* If ID != 0, then it's probably just an unknown id, so ask for
- the root password instead -- root should be able to do
- anything. */
- {
- id = 0; /* Root */
- is_group = 0; /* uid */
- multiple = 1; /* Explicitly ask for root's password. */
- }
- else
- /* No password entry for root. */
- name = "root";
+ {
+ /* [ug]id lookup failed! */
+ if (id != 0 || is_group)
+ /* If ID != 0, then it's probably just an unknown id, so ask for
+ the root password instead -- root should be able to do
+ anything. */
+ {
+ id = 0; /* Root */
+ is_group = 0; /* uid */
+ multiple = 1; /* Explicitly ask for root's password. */
+ }
+ else
+ /* No password entry for root. */
+ name = "root";
+ }
}
while (! name);
@@ -284,12 +286,14 @@ verify_id (uid_t id, int is_group, int multiple,
assert (verify_fn);
if (multiple)
- if (name)
- asprintf (&prompt, "Password for %s%s:",
- is_group ? "group " : "", name);
- else
- asprintf (&prompt, "Password for %s %d:",
- is_group ? "group" : "user", id);
+ {
+ if (name)
+ asprintf (&prompt, "Password for %s%s:",
+ is_group ? "group " : "", name);
+ else
+ asprintf (&prompt, "Password for %s %d:",
+ is_group ? "group" : "user", id);
+ }
/* Prompt the user for the password. */
if (prompt)
@@ -298,7 +302,7 @@ verify_id (uid_t id, int is_group, int multiple,
(*getpass_fn) (prompt, id, is_group, pwd_or_grp, getpass_hook);
free (prompt);
}
- else
+ else
password =
(*getpass_fn) ("Password:", id, is_group, pwd_or_grp, getpass_hook);
diff --git a/libshouldbeinlibc/portinfo.c b/libshouldbeinlibc/portinfo.c
index cb4e9605..4f3ff40b 100644
--- a/libshouldbeinlibc/portinfo.c
+++ b/libshouldbeinlibc/portinfo.c
@@ -1,6 +1,6 @@
/* Print information about a task's ports
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -112,17 +112,19 @@ print_port_info (mach_port_t name, mach_port_type_t type, task_t task,
error_t err =
mach_port_get_set_status (task, name, &members, &members_len);
if (! err)
- if (members_len == 0)
- fprintf (stream, " (empty)");
- else
- {
- fprintf (stream, hex_names ? " (%#x" : " (%u", members[0]);
- for (i = 1; i < members_len; i++)
- fprintf (stream, hex_names ? ", %#x" : ", %u", members[i]);
- fprintf (stream, ")");
- vm_deallocate (mach_task_self (), (vm_address_t)members,
- members_len * sizeof *members);
- }
+ {
+ if (members_len == 0)
+ fprintf (stream, " (empty)");
+ else
+ {
+ fprintf (stream, hex_names ? " (%#x" : " (%u", members[0]);
+ for (i = 1; i < members_len; i++)
+ fprintf (stream, hex_names ? ", %#x" : ", %u", members[i]);
+ fprintf (stream, ")");
+ vm_deallocate (mach_task_self (), (vm_address_t)members,
+ members_len * sizeof *members);
+ }
+ }
}
}
putc ('\n', stream);
diff --git a/libshouldbeinlibc/ugids-verify-auth.c b/libshouldbeinlibc/ugids-verify-auth.c
index af0ef44c..187a526c 100644
--- a/libshouldbeinlibc/ugids-verify-auth.c
+++ b/libshouldbeinlibc/ugids-verify-auth.c
@@ -150,38 +150,40 @@ ugids_verify_make_auth (const struct ugids *ugids,
getpass_fn, getpass_hook, verify_fn, verify_hook);
if (! err)
- /* The user apparently has access to all the ids, try to grant the
- corresponding authentication. */
- if (verify_fn)
- /* Merge the authentication we got from the password server into our
- result. */
- {
- if (num_from > 0)
- /* Use FROM as well as the passwords to get authentication. */
- err = svma_state_add_auths (&svma_state, from, num_from);
-
- if (! err)
- {
- auth_t cur_auth = getauth ();
-
- err =
- auth_makeauth (cur_auth,
- svma_state.auths, MACH_MSG_TYPE_COPY_SEND,
- svma_state.num_auths,
- ugids->eff_uids.ids, ugids->eff_uids.num,
- ugids->avail_uids.ids, ugids->avail_uids.num,
- ugids->eff_gids.ids, ugids->eff_gids.num,
- ugids->avail_gids.ids, ugids->avail_gids.num,
- auth);
- mach_port_deallocate (mach_task_self (), cur_auth);
-
- /* Avoid deallocating FROM when we clean up SVMA_STATE. */
- svma_state.num_auths -= num_from;
- }
- }
- else
- /* Try to authenticate the old fashioned way... */
- err = ugids_make_auth (ugids, from, num_from, auth);
+ {
+ /* The user apparently has access to all the ids, try to grant the
+ corresponding authentication. */
+ if (verify_fn)
+ /* Merge the authentication we got from the password server into our
+ result. */
+ {
+ if (num_from > 0)
+ /* Use FROM as well as the passwords to get authentication. */
+ err = svma_state_add_auths (&svma_state, from, num_from);
+
+ if (! err)
+ {
+ auth_t cur_auth = getauth ();
+
+ err =
+ auth_makeauth (cur_auth,
+ svma_state.auths, MACH_MSG_TYPE_COPY_SEND,
+ svma_state.num_auths,
+ ugids->eff_uids.ids, ugids->eff_uids.num,
+ ugids->avail_uids.ids, ugids->avail_uids.num,
+ ugids->eff_gids.ids, ugids->eff_gids.num,
+ ugids->avail_gids.ids, ugids->avail_gids.num,
+ auth);
+ mach_port_deallocate (mach_task_self (), cur_auth);
+
+ /* Avoid deallocating FROM when we clean up SVMA_STATE. */
+ svma_state.num_auths -= num_from;
+ }
+ }
+ else
+ /* Try to authenticate the old fashioned way... */
+ err = ugids_make_auth (ugids, from, num_from, auth);
+ }
if (verify_fn)
/* Clean up any left over state. */