Date: Fri, 2 Dec 2016 14:08:25 +0800 From: Marcelo Araujo <araujobsdport@gmail.com> To: Marcelo Araujo <araujo@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r309393 - head/usr.sbin/ypldap Message-ID: <CAOfEmZjr8BFyeH97dDDrO0=yqSViTLt1KVHsyJErpq916q5ahw@mail.gmail.com> In-Reply-To: <201612020607.uB267SI7045630@repo.freebsd.org> References: <201612020607.uB267SI7045630@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Forgot MFC after two weeks in my last two commits, so noted in my todo list. Br, 2016-12-02 14:07 GMT+08:00 Marcelo Araujo <araujo@freebsd.org>: > Author: araujo > Date: Fri Dec 2 06:07:27 2016 > New Revision: 309393 > URL: https://svnweb.freebsd.org/changeset/base/309393 > > Log: > Use memset(3) instead of bzero(3). > > Obtained from: OpenBSD (r1.12, r1.20, r1.18 and r1.37) > > Modified: > head/usr.sbin/ypldap/ldapclient.c > head/usr.sbin/ypldap/yp.c > head/usr.sbin/ypldap/ypldap.c > head/usr.sbin/ypldap/ypldap_dns.c > > Modified: head/usr.sbin/ypldap/ldapclient.c > ============================================================ > ================== > --- head/usr.sbin/ypldap/ldapclient.c Fri Dec 2 05:49:22 2016 > (r309392) > +++ head/usr.sbin/ypldap/ldapclient.c Fri Dec 2 06:07:27 2016 > (r309393) > @@ -363,7 +363,7 @@ ldapclient(int pipe_main2client[2]) > return (pid); > } > > - bzero(&env, sizeof(env)); > + memset(&env, 0, sizeof(env)); > TAILQ_INIT(&env.sc_idms); > > if ((pw = getpwnam(YPLDAP_USER)) == NULL) > @@ -437,7 +437,7 @@ client_build_req(struct idm *idm, struct > char **ldap_attrs; > int i, k; > > - bzero(ir, sizeof(*ir)); > + memset(ir, 0, sizeof(*ir)); > for (i = min_attr; i < max_attr; i++) { > if (idm->idm_flags & F_FIXED_ATTR(i)) { > if (strlcat(ir->ir_line, idm->idm_attrs[i], > @@ -594,7 +594,7 @@ client_try_idm(struct env *env, struct i > aldap_freemsg(m); > } > > - bzero(attrs, sizeof(attrs)); > + memset(attrs, 0, sizeof(attrs)); > for (i = 0, j = 0; i < ATTR_MAX; i++) { > if (idm->idm_flags & F_FIXED_ATTR(i)) > continue; > @@ -611,7 +611,7 @@ client_try_idm(struct env *env, struct i > idm->idm_filters[FILTER_USER], 0, ATTR_MAX, IMSG_PW_ENTRY) == > -1) > goto bad; > > - bzero(attrs, sizeof(attrs)); > + memset(attrs, 0, sizeof(attrs)); > for (i = ATTR_GR_MIN, j = 0; i < ATTR_GR_MAX; i++) { > if (idm->idm_flags & F_FIXED_ATTR(i)) > continue; > > Modified: head/usr.sbin/ypldap/yp.c > ============================================================ > ================== > --- head/usr.sbin/ypldap/yp.c Fri Dec 2 05:49:22 2016 (r309392) > +++ head/usr.sbin/ypldap/yp.c Fri Dec 2 06:07:27 2016 (r309393) > @@ -342,7 +342,7 @@ ypproc_match_2_svc(ypreq_key *arg, struc > log_debug("argument too long"); > return (NULL); > } > - bzero(key, sizeof(key)); > + memset(key, 0, sizeof(key)); > (void)strncpy(key, arg->key.keydat_val, arg->key.keydat_len); > > if (strcmp(arg->map, "passwd.byname") == 0 || > @@ -486,7 +486,7 @@ ypproc_next_2_svc(ypreq_key *arg, struct > > if (strcmp(arg->map, "passwd.byname") == 0 || > strcmp(arg->map, "master.passwd.byname") == 0) { > - bzero(key, sizeof(key)); > + memset(key, 0, sizeof(key)); > (void)strncpy(key, arg->key.keydat_val, > arg->key.keydat_len); > ukey.ue_line = key; > @@ -517,7 +517,7 @@ ypproc_next_2_svc(ypreq_key *arg, struct > > > } else if (strcmp(arg->map, "group.byname") == 0) { > - bzero(key, sizeof(key)); > + memset(key, 0, sizeof(key)); > (void)strncpy(key, arg->key.keydat_val, > arg->key.keydat_len); > > @@ -567,7 +567,7 @@ ypproc_master_2_svc(ypreq_nokey *arg, st > static struct ypresp_master res; > static char master[YPMAXPEER + 1]; > > - bzero(&res, sizeof(res)); > + memset(&res, 0, sizeof(res)); > if (yp_valid_domain(arg->domain, (struct ypresp_val *)&res) == -1) > return (&res); > > @@ -620,7 +620,7 @@ yp_make_val(struct ypresp_val *res, char > { > static char buf[LINE_WIDTH]; > > - bzero(buf, sizeof(buf)); > + memset(buf, 0, sizeof(buf)); > > if (replacecolon) > line[strlen(line)] = ':'; > @@ -640,8 +640,8 @@ yp_make_keyval(struct ypresp_key_val *re > static char keybuf[YPMAXRECORD+1]; > static char buf[LINE_WIDTH]; > > - bzero(keybuf, sizeof(keybuf)); > - bzero(buf, sizeof(buf)); > + memset(keybuf, 0, sizeof(keybuf)); > + memset(buf, 0, sizeof(buf)); > > (void)strlcpy(keybuf, key, sizeof(keybuf)); > res->key.keydat_len = strlen(keybuf); > > Modified: head/usr.sbin/ypldap/ypldap.c > ============================================================ > ================== > --- head/usr.sbin/ypldap/ypldap.c Fri Dec 2 05:49:22 2016 > (r309392) > +++ head/usr.sbin/ypldap/ypldap.c Fri Dec 2 06:07:27 2016 > (r309393) > @@ -609,7 +609,7 @@ main(int argc, char *argv[]) > #warning disabling privilege revocation in debug mode > #endif > > - bzero(&tv, sizeof(tv)); > + memset(&tv, 0, sizeof(tv)); > evtimer_set(&ev_timer, main_init_timer, &env); > evtimer_add(&ev_timer, &tv); > > > Modified: head/usr.sbin/ypldap/ypldap_dns.c > ============================================================ > ================== > --- head/usr.sbin/ypldap/ypldap_dns.c Fri Dec 2 05:49:22 2016 > (r309392) > +++ head/usr.sbin/ypldap/ypldap_dns.c Fri Dec 2 06:07:27 2016 > (r309393) > @@ -212,7 +212,7 @@ host_dns(const char *s, struct ypldap_ad > struct sockaddr_in6 *sa_in6; > struct ypldap_addr *h; > > - bzero(&hints, sizeof(hints)); > + memset(&hints, 0, sizeof(hints)); > hints.ai_family = PF_UNSPEC; > hints.ai_socktype = SOCK_DGRAM; /* DUMMY */ > error = getaddrinfo(s, NULL, &hints, &res0); > > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/> \/ \ ^ Power To Server. .\. /_)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfEmZjr8BFyeH97dDDrO0=yqSViTLt1KVHsyJErpq916q5ahw>