* [PATCH 1/1] passwd: Support passwd file custom directory @ 2014-06-19 9:07 Herve Codina 2014-07-02 6:45 ` Herve Codina 0 siblings, 1 reply; 7+ messages in thread From: Herve Codina @ 2014-06-19 9:07 UTC (permalink / raw) To: barebox; +Cc: Herve Codina Support custom directory for passwd file instead of hardcoded /env/etc/ This directory is set using CONFIG_PASSWORD_DIR. Signed-off-by: Herve Codina <Herve.CODINA@celad.com> --- common/Kconfig | 8 ++++++++ include/password.h | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 1afee93..d4cf61b 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -414,6 +414,14 @@ endchoice endif +config PASSWORD_DIR + string + prompt "passwd directory" + default "/env/etc" + depends on PASSWORD + help + Define directory for passwd file. + config DYNAMIC_CRC_TABLE bool depends on CRC32 diff --git a/include/password.h b/include/password.h index 0dd1054..9d84685 100644 --- a/include/password.h +++ b/include/password.h @@ -18,8 +18,14 @@ #ifndef __PASSWORD_H__ #define __PASSWORD_H__ -#define PASSWD_FILE "/env/etc/passwd" -#define PASSWD_DIR "/env/etc/" +#ifdef CONFIG_PASSWORD_DIR +#define PASSWD_DIR CONFIG_PASSWORD_DIR +#else +#define PASSWD_DIR "/env/etc" +#endif + +#define PASSWD_FILE PASSWD_DIR"/passwd" + #define HIDE (0 << 0) #define STAR (1 << 1) -- 1.7.9.5 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] passwd: Support passwd file custom directory 2014-06-19 9:07 [PATCH 1/1] passwd: Support passwd file custom directory Herve Codina @ 2014-07-02 6:45 ` Herve Codina 2014-07-03 6:54 ` Sascha Hauer 0 siblings, 1 reply; 7+ messages in thread From: Herve Codina @ 2014-07-02 6:45 UTC (permalink / raw) To: barebox; +Cc: Hervé CODINA Hi, I haven't got any news about this patch. Has it been reviewed ? I hope it was not lost in the flow of other patches. If so, i can resend it. Best regards, Herve Le 19/06/2014 11:07, Hervé CODINA a écrit : > Support custom directory for passwd file instead of hardcoded /env/etc/ > This directory is set using CONFIG_PASSWORD_DIR. > > Signed-off-by: Herve Codina <Herve.CODINA@celad.com> > --- > common/Kconfig | 8 ++++++++ > include/password.h | 10 ++++++++-- > 2 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/common/Kconfig b/common/Kconfig > index 1afee93..d4cf61b 100644 > --- a/common/Kconfig > +++ b/common/Kconfig > @@ -414,6 +414,14 @@ endchoice > > endif > > +config PASSWORD_DIR > + string > + prompt "passwd directory" > + default "/env/etc" > + depends on PASSWORD > + help > + Define directory for passwd file. > + > config DYNAMIC_CRC_TABLE > bool > depends on CRC32 > diff --git a/include/password.h b/include/password.h > index 0dd1054..9d84685 100644 > --- a/include/password.h > +++ b/include/password.h > @@ -18,8 +18,14 @@ > #ifndef __PASSWORD_H__ > #define __PASSWORD_H__ > > -#define PASSWD_FILE "/env/etc/passwd" > -#define PASSWD_DIR "/env/etc/" > +#ifdef CONFIG_PASSWORD_DIR > +#define PASSWD_DIR CONFIG_PASSWORD_DIR > +#else > +#define PASSWD_DIR "/env/etc" > +#endif > + > +#define PASSWD_FILE PASSWD_DIR"/passwd" > + > > #define HIDE (0 << 0) > #define STAR (1 << 1) > _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] passwd: Support passwd file custom directory 2014-07-02 6:45 ` Herve Codina @ 2014-07-03 6:54 ` Sascha Hauer 2014-07-03 6:57 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 7+ messages in thread From: Sascha Hauer @ 2014-07-03 6:54 UTC (permalink / raw) To: Herve Codina; +Cc: barebox On Wed, Jul 02, 2014 at 08:45:28AM +0200, Herve Codina wrote: > Hi, > > I haven't got any news about this patch. > Has it been reviewed ? > > I hope it was not lost in the flow of other patches. > If so, i can resend it. Sorry, I have seen it but then forgot to write an answer. > > diff --git a/include/password.h b/include/password.h > > index 0dd1054..9d84685 100644 > > --- a/include/password.h > > +++ b/include/password.h > > @@ -18,8 +18,14 @@ > > #ifndef __PASSWORD_H__ > > #define __PASSWORD_H__ > > > > -#define PASSWD_FILE "/env/etc/passwd" > > -#define PASSWD_DIR "/env/etc/" > > +#ifdef CONFIG_PASSWORD_DIR > > +#define PASSWD_DIR CONFIG_PASSWORD_DIR > > +#else > > +#define PASSWD_DIR "/env/etc" > > +#endif > > + > > +#define PASSWD_FILE PASSWD_DIR"/passwd" I don't like this ifdeffery. If you want to have this configurable please make a static char *passwd_file = "/env/etc/passwd" int set_passwd_file(const char *file) { passwd_file = file; } And call it from your board code. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] passwd: Support passwd file custom directory 2014-07-03 6:54 ` Sascha Hauer @ 2014-07-03 6:57 ` Jean-Christophe PLAGNIOL-VILLARD 2014-07-03 7:36 ` Herve Codina 0 siblings, 1 reply; 7+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2014-07-03 6:57 UTC (permalink / raw) To: Sascha Hauer; +Cc: Herve Codina, barebox On Jul 3, 2014, at 2:54 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > > On Wed, Jul 02, 2014 at 08:45:28AM +0200, Herve Codina wrote: >> Hi, >> >> I haven't got any news about this patch. >> Has it been reviewed ? >> >> I hope it was not lost in the flow of other patches. >> If so, i can resend it. > > Sorry, I have seen it but then forgot to write an answer. > >>> diff --git a/include/password.h b/include/password.h >>> index 0dd1054..9d84685 100644 >>> --- a/include/password.h >>> +++ b/include/password.h >>> @@ -18,8 +18,14 @@ >>> #ifndef __PASSWORD_H__ >>> #define __PASSWORD_H__ >>> >>> -#define PASSWD_FILE "/env/etc/passwd" >>> -#define PASSWD_DIR "/env/etc/" >>> +#ifdef CONFIG_PASSWORD_DIR >>> +#define PASSWD_DIR CONFIG_PASSWORD_DIR >>> +#else >>> +#define PASSWD_DIR "/env/etc" >>> +#endif >>> + >>> +#define PASSWD_FILE PASSWD_DIR"/passwd" > I don’t like this idea to have the passwd file configurable Why do we need thant? > I don't like this ifdeffery. If you want to have this configurable > please make a > > static char *passwd_file = "/env/etc/passwd" > > int set_passwd_file(const char *file) > { > passwd_file = file; > } > > And call it from your board code. > > Sascha > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] passwd: Support passwd file custom directory 2014-07-03 6:57 ` Jean-Christophe PLAGNIOL-VILLARD @ 2014-07-03 7:36 ` Herve Codina 2014-07-03 10:19 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 1 reply; 7+ messages in thread From: Herve Codina @ 2014-07-03 7:36 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD, Sascha Hauer; +Cc: barebox Le 03/07/2014 08:57, Jean-Christophe PLAGNIOL-VILLARD a écrit : > > On Jul 3, 2014, at 2:54 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote: > >> >> On Wed, Jul 02, 2014 at 08:45:28AM +0200, Herve Codina wrote: >>> Hi, >>> >>> I haven't got any news about this patch. >>> Has it been reviewed ? >>> >>> I hope it was not lost in the flow of other patches. >>> If so, i can resend it. >> >> Sorry, I have seen it but then forgot to write an answer. >> >>>> diff --git a/include/password.h b/include/password.h >>>> index 0dd1054..9d84685 100644 >>>> --- a/include/password.h >>>> +++ b/include/password.h >>>> @@ -18,8 +18,14 @@ >>>> #ifndef __PASSWORD_H__ >>>> #define __PASSWORD_H__ >>>> >>>> -#define PASSWD_FILE "/env/etc/passwd" >>>> -#define PASSWD_DIR "/env/etc/" >>>> +#ifdef CONFIG_PASSWORD_DIR >>>> +#define PASSWD_DIR CONFIG_PASSWORD_DIR >>>> +#else >>>> +#define PASSWD_DIR "/env/etc" >>>> +#endif >>>> + >>>> +#define PASSWD_FILE PASSWD_DIR"/passwd" >> > > I don’t like this idea to have the passwd file configurable > > Why do we need thant? In my case i have multiple envfs images loaded with loadenv. and i need to have passwd file from one of these image. I have /env which is my barebox env and /user which is loaded from envfs image. I need passwd file in /user/passwd. In a more general case, the abilily to have passwd file from a directory other than /env can lead, in a very simple way, to the ability to have passwd file from a fat filesystem or an ubifs filesystem I use #define to set this passwd file because i want to set it at compile time and not at runtime. If you prefer runtime configuration, i can do the patch according to sasha suggestion. Herve >> I don't like this ifdeffery. If you want to have this configurable >> please make a >> >> static char *passwd_file = "/env/etc/passwd" >> >> int set_passwd_file(const char *file) >> { >> passwd_file = file; >> } >> >> And call it from your board code. >> >> Sascha >> >> -- >> Pengutronix e.K. | | >> Industrial Linux Solutions | http://www.pengutronix.de/ | >> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | >> >> _______________________________________________ >> barebox mailing list >> barebox@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/barebox > _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] passwd: Support passwd file custom directory 2014-07-03 7:36 ` Herve Codina @ 2014-07-03 10:19 ` Jean-Christophe PLAGNIOL-VILLARD 2014-07-03 11:09 ` Herve Codina 0 siblings, 1 reply; 7+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2014-07-03 10:19 UTC (permalink / raw) To: Herve Codina; +Cc: barebox On Jul 3, 2014, at 3:36 PM, Herve Codina <herve.codina@celad.com> wrote: > > > > Le 03/07/2014 08:57, Jean-Christophe PLAGNIOL-VILLARD a écrit : >> >> On Jul 3, 2014, at 2:54 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote: >> >>> >>> On Wed, Jul 02, 2014 at 08:45:28AM +0200, Herve Codina wrote: >>>> Hi, >>>> >>>> I haven't got any news about this patch. >>>> Has it been reviewed ? >>>> >>>> I hope it was not lost in the flow of other patches. >>>> If so, i can resend it. >>> >>> Sorry, I have seen it but then forgot to write an answer. >>> >>>>> diff --git a/include/password.h b/include/password.h >>>>> index 0dd1054..9d84685 100644 >>>>> --- a/include/password.h >>>>> +++ b/include/password.h >>>>> @@ -18,8 +18,14 @@ >>>>> #ifndef __PASSWORD_H__ >>>>> #define __PASSWORD_H__ >>>>> >>>>> -#define PASSWD_FILE "/env/etc/passwd" >>>>> -#define PASSWD_DIR "/env/etc/" >>>>> +#ifdef CONFIG_PASSWORD_DIR >>>>> +#define PASSWD_DIR CONFIG_PASSWORD_DIR >>>>> +#else >>>>> +#define PASSWD_DIR "/env/etc" >>>>> +#endif >>>>> + >>>>> +#define PASSWD_FILE PASSWD_DIR"/passwd" >>> >> >> I don’t like this idea to have the passwd file configurable >> >> Why do we need thant? > > In my case i have multiple envfs images loaded with loadenv. > and i need to have passwd file from one of these image. > I have /env which is my barebox env and /user which is loaded from envfs > image. I need passwd file in /user/passwd. > > In a more general case, the abilily to have passwd file from a directory > other than /env can lead, in a very simple way, to the ability to have > passwd file from a fat filesystem or an ubifs filesystem > > I use #define to set this passwd file because i want to set it at > compile time and not at runtime. > > If you prefer runtime configuration, i can do the patch according to > sasha suggestion. so simply use a symbol link Best Regards, J. > > Herve > > >>> I don't like this ifdeffery. If you want to have this configurable >>> please make a >>> >>> static char *passwd_file = "/env/etc/passwd" >>> >>> int set_passwd_file(const char *file) >>> { >>> passwd_file = file; >>> } >>> >>> And call it from your board code. >>> >>> Sascha >>> >>> -- >>> Pengutronix e.K. | | >>> Industrial Linux Solutions | http://www.pengutronix.de/ | >>> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | >>> >>> _______________________________________________ >>> barebox mailing list >>> barebox@lists.infradead.org >>> http://lists.infradead.org/mailman/listinfo/barebox >> _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] passwd: Support passwd file custom directory 2014-07-03 10:19 ` Jean-Christophe PLAGNIOL-VILLARD @ 2014-07-03 11:09 ` Herve Codina 0 siblings, 0 replies; 7+ messages in thread From: Herve Codina @ 2014-07-03 11:09 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox Le 03/07/2014 12:19, Jean-Christophe PLAGNIOL-VILLARD a écrit : > > On Jul 3, 2014, at 3:36 PM, Herve Codina <herve.codina@celad.com> wrote: > >> >> >> >> Le 03/07/2014 08:57, Jean-Christophe PLAGNIOL-VILLARD a écrit : >>> >>> On Jul 3, 2014, at 2:54 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote: >>> >>>> >>>> On Wed, Jul 02, 2014 at 08:45:28AM +0200, Herve Codina wrote: >>>>> Hi, >>>>> >>>>> I haven't got any news about this patch. >>>>> Has it been reviewed ? >>>>> >>>>> I hope it was not lost in the flow of other patches. >>>>> If so, i can resend it. >>>> >>>> Sorry, I have seen it but then forgot to write an answer. >>>> >>>>>> diff --git a/include/password.h b/include/password.h >>>>>> index 0dd1054..9d84685 100644 >>>>>> --- a/include/password.h >>>>>> +++ b/include/password.h >>>>>> @@ -18,8 +18,14 @@ >>>>>> #ifndef __PASSWORD_H__ >>>>>> #define __PASSWORD_H__ >>>>>> >>>>>> -#define PASSWD_FILE "/env/etc/passwd" >>>>>> -#define PASSWD_DIR "/env/etc/" >>>>>> +#ifdef CONFIG_PASSWORD_DIR >>>>>> +#define PASSWD_DIR CONFIG_PASSWORD_DIR >>>>>> +#else >>>>>> +#define PASSWD_DIR "/env/etc" >>>>>> +#endif >>>>>> + >>>>>> +#define PASSWD_FILE PASSWD_DIR"/passwd" >>>> >>> >>> I don’t like this idea to have the passwd file configurable >>> >>> Why do we need thant? >> >> In my case i have multiple envfs images loaded with loadenv. >> and i need to have passwd file from one of these image. >> I have /env which is my barebox env and /user which is loaded from envfs >> image. I need passwd file in /user/passwd. >> >> In a more general case, the abilily to have passwd file from a directory >> other than /env can lead, in a very simple way, to the ability to have >> passwd file from a fat filesystem or an ubifs filesystem >> >> I use #define to set this passwd file because i want to set it at >> compile time and not at runtime. >> >> If you prefer runtime configuration, i can do the patch according to >> sasha suggestion. > > so simply use a symbol link Of course, that's a good way to do !!!! I had missed that symlinks are supported in envfs when i wrote the patch. You can simply forgot my patch and i am sorry for this noise. Best regards, Herve > > Best Regards, > J. >> >> Herve >> >> >>>> I don't like this ifdeffery. If you want to have this configurable >>>> please make a >>>> >>>> static char *passwd_file = "/env/etc/passwd" >>>> >>>> int set_passwd_file(const char *file) >>>> { >>>> passwd_file = file; >>>> } >>>> >>>> And call it from your board code. >>>> >>>> Sascha >>>> >>>> -- >>>> Pengutronix e.K. | | >>>> Industrial Linux Solutions | http://www.pengutronix.de/ | >>>> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | >>>> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | >>>> >>>> _______________________________________________ >>>> barebox mailing list >>>> barebox@lists.infradead.org >>>> http://lists.infradead.org/mailman/listinfo/barebox >>> > _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-07-03 11:09 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-06-19 9:07 [PATCH 1/1] passwd: Support passwd file custom directory Herve Codina 2014-07-02 6:45 ` Herve Codina 2014-07-03 6:54 ` Sascha Hauer 2014-07-03 6:57 ` Jean-Christophe PLAGNIOL-VILLARD 2014-07-03 7:36 ` Herve Codina 2014-07-03 10:19 ` Jean-Christophe PLAGNIOL-VILLARD 2014-07-03 11:09 ` Herve Codina
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox