* [Buildroot] [PATCH 1/1] cgic: new package
@ 2015-01-16 16:23 David Bender
2015-01-17 19:21 ` Baruch Siach
0 siblings, 1 reply; 10+ messages in thread
From: David Bender @ 2015-01-16 16:23 UTC (permalink / raw)
To: buildroot
Added cgic library.
Signed-off-by: Dave Bender <bender@benegon.com>
---
package/Config.in | 1 +
package/cgic/Config.in | 6 ++++
package/cgic/cgic-0000-prepare_makefile.patch | 40 +++++++++++++++++++++++++
package/cgic/cgic.mk | 36 ++++++++++++++++++++++
4 files changed, 83 insertions(+), 0 deletions(-)
create mode 100644 package/cgic/Config.in
create mode 100644 package/cgic/cgic-0000-prepare_makefile.patch
create mode 100644 package/cgic/cgic.mk
diff --git a/package/Config.in b/package/Config.in
index 266de13..a6fa27d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -816,6 +816,7 @@ menu "Networking"
source "package/agentpp/Config.in"
source "package/c-ares/Config.in"
source "package/canfestival/Config.in"
+ source "package/cgic/Config.in"
source "package/cppzmq/Config.in"
source "package/czmq/Config.in"
source "package/filemq/Config.in"
diff --git a/package/cgic/Config.in b/package/cgic/Config.in
new file mode 100644
index 0000000..402460d
--- /dev/null
+++ b/package/cgic/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_CGIC
+ bool "cgic"
+ help
+ C CGI library
+
+ http://www.boutell.com/cgic/
diff --git a/package/cgic/cgic-0000-prepare_makefile.patch b/package/cgic/cgic-0000-prepare_makefile.patch
new file mode 100644
index 0000000..46b7a81
--- /dev/null
+++ b/package/cgic/cgic-0000-prepare_makefile.patch
@@ -0,0 +1,40 @@
+Binary files cgic206/cgic.o and cgic206-br/cgic.o differ
+Binary files cgic206/libcgic.a and cgic206-br/libcgic.a differ
+diff -rupN cgic206/Makefile cgic206-br/Makefile
+--- cgic206/Makefile 2014-03-16 18:17:11.000000000 -0400
++++ cgic206-br/Makefile 2015-01-16 11:18:03.714874000 -0500
+@@ -1,15 +1,14 @@
+-CFLAGS=-g -Wall
+-CC=gcc
+-AR=ar
+-RANLIB=ranlib
+ LIBS=-L./ -lcgic
+
+ all: libcgic.a cgictest.cgi capture
+
+ install: libcgic.a
+- cp libcgic.a /usr/local/lib
+- cp cgic.h /usr/local/include
+- @echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include.
++ cp libcgic.a $(PREFIX)/usr/lib
++ cp cgic.h $(PREFIX)/usr/include
++ @echo libcgic.a is in $(PREFIX)/usr/lib. cgic.h is in $(PREFIX)/usr/include.
++
++cgi.o: cgic.c cgic.h
++ $(CC) $(CFLAGS) cgic.c -o cgic.o
+
+ libcgic.a: cgic.o cgic.h
+ rm -f libcgic.a
+@@ -19,10 +18,10 @@ libcgic.a: cgic.o cgic.h
+ #mingw32 and cygwin users: replace .cgi with .exe
+
+ cgictest.cgi: cgictest.o libcgic.a
+- gcc cgictest.o -o cgictest.cgi ${LIBS}
++ $(CC) cgictest.o -o cgictest.cgi ${LIBS}
+
+ capture: capture.o libcgic.a
+- gcc capture.o -o capture ${LIBS}
++ $(CC) capture.o -o capture ${LIBS}
+
+ clean:
+ rm -f *.o *.a cgictest.cgi capture
diff --git a/package/cgic/cgic.mk b/package/cgic/cgic.mk
new file mode 100644
index 0000000..378e1cd
--- /dev/null
+++ b/package/cgic/cgic.mk
@@ -0,0 +1,36 @@
+################################################################################
+#
+# cgic
+#
+################################################################################
+
+CGIC_VERSION = 2.06
+CGIC_SOURCE = cgic206.tar.gz
+CGIC_SITE = http://boutell.com/cgic
+CGIC_LICENSE = Custom
+CGIC_LICENSE_FILES = license.txt
+
+CGIC_ENV = AR=$(TARGET_CROSS)ar \
+ CC=$(TARGET_CROSS)gcc \
+ RANLIB=$(TARGET_CROSS)ranlib
+
+define CGIC_BUILD_CMDS
+ (cd $(@D); \
+ $(CGIC_ENV) \
+ make libcgic.a \
+ )
+endef
+
+define CGIC_INSTALL_STAGING_CMDS
+ (cd $(@D); \
+ PREFIX=$(STAGING_DIR) make install \
+ )
+endef
+
+define CGIC_INSTALL_TARGET_CMDS
+ (cd $(@D); \
+ PREFIX=$(TARGET_DIR) make install \
+ )
+endef
+
+$(eval $(generic-package))
--
1.7.8.6
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/1] cgic: new package
2015-01-16 16:23 [Buildroot] [PATCH 1/1] cgic: new package David Bender
@ 2015-01-17 19:21 ` Baruch Siach
2015-01-22 19:11 ` [Buildroot] [PATCH 1/3] " David Bender
0 siblings, 1 reply; 10+ messages in thread
From: Baruch Siach @ 2015-01-17 19:21 UTC (permalink / raw)
To: buildroot
Hi David,
On Fri, Jan 16, 2015 at 11:23:35AM -0500, David Bender wrote:
> +CGIC_ENV = AR=$(TARGET_CROSS)ar \
> + CC=$(TARGET_CROSS)gcc \
> + RANLIB=$(TARGET_CROSS)ranlib
TARGET_CONFIGURE_OPTS already includes all these and more.
> +
> +define CGIC_BUILD_CMDS
> + (cd $(@D); \
> + $(CGIC_ENV) \
> + make libcgic.a \
> + )
> +endef
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/3] cgic: new package
2015-01-17 19:21 ` Baruch Siach
@ 2015-01-22 19:11 ` David Bender
2015-01-22 19:11 ` [Buildroot] [PATCH 2/3] Restore cgiFormFileGetTempfileName and make creation permissions more secure David Bender
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: David Bender @ 2015-01-22 19:11 UTC (permalink / raw)
To: buildroot
Added cgic library.
Signed-off-by: Dave Bender <bender@benegon.com>
Signed-off-by: David Bender <codehero@gmail.com>
---
package/Config.in | 1 +
package/cgic/Config.in | 6 ++++
package/cgic/cgic-0000-prepare_makefile.patch | 40 +++++++++++++++++++++++++
package/cgic/cgic.mk | 36 ++++++++++++++++++++++
4 files changed, 83 insertions(+), 0 deletions(-)
create mode 100644 package/cgic/Config.in
create mode 100644 package/cgic/cgic-0000-prepare_makefile.patch
create mode 100644 package/cgic/cgic.mk
diff --git a/package/Config.in b/package/Config.in
index 266de13..a6fa27d 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -816,6 +816,7 @@ menu "Networking"
source "package/agentpp/Config.in"
source "package/c-ares/Config.in"
source "package/canfestival/Config.in"
+ source "package/cgic/Config.in"
source "package/cppzmq/Config.in"
source "package/czmq/Config.in"
source "package/filemq/Config.in"
diff --git a/package/cgic/Config.in b/package/cgic/Config.in
new file mode 100644
index 0000000..402460d
--- /dev/null
+++ b/package/cgic/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_CGIC
+ bool "cgic"
+ help
+ C CGI library
+
+ http://www.boutell.com/cgic/
diff --git a/package/cgic/cgic-0000-prepare_makefile.patch b/package/cgic/cgic-0000-prepare_makefile.patch
new file mode 100644
index 0000000..46b7a81
--- /dev/null
+++ b/package/cgic/cgic-0000-prepare_makefile.patch
@@ -0,0 +1,40 @@
+Binary files cgic206/cgic.o and cgic206-br/cgic.o differ
+Binary files cgic206/libcgic.a and cgic206-br/libcgic.a differ
+diff -rupN cgic206/Makefile cgic206-br/Makefile
+--- cgic206/Makefile 2014-03-16 18:17:11.000000000 -0400
++++ cgic206-br/Makefile 2015-01-16 11:18:03.714874000 -0500
+@@ -1,15 +1,14 @@
+-CFLAGS=-g -Wall
+-CC=gcc
+-AR=ar
+-RANLIB=ranlib
+ LIBS=-L./ -lcgic
+
+ all: libcgic.a cgictest.cgi capture
+
+ install: libcgic.a
+- cp libcgic.a /usr/local/lib
+- cp cgic.h /usr/local/include
+- @echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include.
++ cp libcgic.a $(PREFIX)/usr/lib
++ cp cgic.h $(PREFIX)/usr/include
++ @echo libcgic.a is in $(PREFIX)/usr/lib. cgic.h is in $(PREFIX)/usr/include.
++
++cgi.o: cgic.c cgic.h
++ $(CC) $(CFLAGS) cgic.c -o cgic.o
+
+ libcgic.a: cgic.o cgic.h
+ rm -f libcgic.a
+@@ -19,10 +18,10 @@ libcgic.a: cgic.o cgic.h
+ #mingw32 and cygwin users: replace .cgi with .exe
+
+ cgictest.cgi: cgictest.o libcgic.a
+- gcc cgictest.o -o cgictest.cgi ${LIBS}
++ $(CC) cgictest.o -o cgictest.cgi ${LIBS}
+
+ capture: capture.o libcgic.a
+- gcc capture.o -o capture ${LIBS}
++ $(CC) capture.o -o capture ${LIBS}
+
+ clean:
+ rm -f *.o *.a cgictest.cgi capture
diff --git a/package/cgic/cgic.mk b/package/cgic/cgic.mk
new file mode 100644
index 0000000..378e1cd
--- /dev/null
+++ b/package/cgic/cgic.mk
@@ -0,0 +1,36 @@
+################################################################################
+#
+# cgic
+#
+################################################################################
+
+CGIC_VERSION = 2.06
+CGIC_SOURCE = cgic206.tar.gz
+CGIC_SITE = http://boutell.com/cgic
+CGIC_LICENSE = Custom
+CGIC_LICENSE_FILES = license.txt
+
+CGIC_ENV = AR=$(TARGET_CROSS)ar \
+ CC=$(TARGET_CROSS)gcc \
+ RANLIB=$(TARGET_CROSS)ranlib
+
+define CGIC_BUILD_CMDS
+ (cd $(@D); \
+ $(CGIC_ENV) \
+ make libcgic.a \
+ )
+endef
+
+define CGIC_INSTALL_STAGING_CMDS
+ (cd $(@D); \
+ PREFIX=$(STAGING_DIR) make install \
+ )
+endef
+
+define CGIC_INSTALL_TARGET_CMDS
+ (cd $(@D); \
+ PREFIX=$(TARGET_DIR) make install \
+ )
+endef
+
+$(eval $(generic-package))
--
1.7.8.6
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/3] Restore cgiFormFileGetTempfileName and make creation permissions more secure
2015-01-22 19:11 ` [Buildroot] [PATCH 1/3] " David Bender
@ 2015-01-22 19:11 ` David Bender
2015-01-25 15:53 ` Yann E. MORIN
2015-01-22 19:11 ` [Buildroot] [PATCH 3/3] use TARGET_CONFIGURE_OPTS instead of homegrown ENV David Bender
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: David Bender @ 2015-01-22 19:11 UTC (permalink / raw)
To: buildroot
Signed-off-by: David Bender <codehero@gmail.com>
---
package/cgic/cgic-0001-file_enhancements.patch | 81 ++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
create mode 100644 package/cgic/cgic-0001-file_enhancements.patch
diff --git a/package/cgic/cgic-0001-file_enhancements.patch b/package/cgic/cgic-0001-file_enhancements.patch
new file mode 100644
index 0000000..f09a73f
--- /dev/null
+++ b/package/cgic/cgic-0001-file_enhancements.patch
@@ -0,0 +1,81 @@
+diff -rupN cgic206/cgic.c cgic206_tempfile/cgic.c
+--- cgic206/cgic.c 2014-03-16 18:17:11.000000000 -0400
++++ cgic206_tempfile/cgic.c 2015-01-21 11:58:45.436384908 -0500
+@@ -22,6 +22,8 @@
+ #define CGICDEBUGEND
+ #endif /* CGICDEBUG */
+
++#define _GNU_SOURCE
++
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+@@ -34,11 +36,11 @@
+ #include <io.h>
+
+ /* cgic 2.01 */
+-#include <fcntl.h>
+
+ #else
+ #include <unistd.h>
+ #endif /* WIN32 */
++#include <fcntl.h>
+ #include "cgic.h"
+
+ #define cgiStrEq(a, b) (!strcmp((a), (b)))
+@@ -636,16 +638,17 @@ static cgiParseResultType getTempFileNam
+ window between the file's creation and the
+ chmod call (glibc 2.0.6 and lower might
+ otherwise have allowed this). */
++ mode_t umode;
+ int outfd;
++ umode = umask(0600);
+ strcpy(tfileName, cgicTempDir "/cgicXXXXXX");
+- outfd = mkstemp(tfileName);
++ outfd = mkostemp(tfileName, O_CLOEXEC | O_NOATIME);
++ umask(umode);
+ if (outfd == -1) {
+ return cgiParseIO;
+ }
+- close(outfd);
+- /* Fix the permissions */
+- if (chmod(tfileName, 0600) != 0) {
+- unlink(tfileName);
++
++ if (close(outfd)) {
+ return cgiParseIO;
+ }
+ #else
+@@ -1275,6 +1278,20 @@ cgiFormResultType cgiFormFileContentType
+ }
+ }
+
++const char* cgiFormFileGetTempfileName(
++ char* name)
++{
++ cgiFormEntry *e;
++ e = cgiFormEntryFindFirst(name);
++ if (!e) {
++ return NULL;
++ } else if (!strlen(e->tfileName)) {
++ return NULL;
++ } else {
++ return e->tfileName;
++ }
++}
++
+ cgiFormResultType cgiFormFileSize(
+ char *name, int *sizeP)
+ {
+diff -rupN cgic206/cgic.h cgic206_tempfile/cgic.h
+--- cgic206/cgic.h 2014-03-16 18:17:11.000000000 -0400
++++ cgic206_tempfile/cgic.h 2015-01-21 11:53:02.915148026 -0500
+@@ -141,6 +141,8 @@ extern cgiFormResultType cgiFormRadio(
+ char *name, char **valuesText, int valuesTotal,
+ int *result, int defaultV);
+
++extern const char* cgiFormFileGetTempfileName(char* name);
++
+ /* The paths returned by this function are the original names of files
+ as reported by the uploading web browser and shoult NOT be
+ blindly assumed to be "safe" names for server-side use! */
--
1.7.8.6
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 3/3] use TARGET_CONFIGURE_OPTS instead of homegrown ENV
2015-01-22 19:11 ` [Buildroot] [PATCH 1/3] " David Bender
2015-01-22 19:11 ` [Buildroot] [PATCH 2/3] Restore cgiFormFileGetTempfileName and make creation permissions more secure David Bender
@ 2015-01-22 19:11 ` David Bender
2015-01-22 21:32 ` Danomi Manchego
2015-01-22 21:25 ` [Buildroot] [PATCH 1/3] cgic: new package Danomi Manchego
2015-01-25 14:53 ` Yann E. MORIN
3 siblings, 1 reply; 10+ messages in thread
From: David Bender @ 2015-01-22 19:11 UTC (permalink / raw)
To: buildroot
Signed-off-by: David Bender <codehero@gmail.com>
---
package/cgic/cgic.mk | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/package/cgic/cgic.mk b/package/cgic/cgic.mk
index 378e1cd..a575a16 100644
--- a/package/cgic/cgic.mk
+++ b/package/cgic/cgic.mk
@@ -9,14 +9,11 @@ CGIC_SOURCE = cgic206.tar.gz
CGIC_SITE = http://boutell.com/cgic
CGIC_LICENSE = Custom
CGIC_LICENSE_FILES = license.txt
-
-CGIC_ENV = AR=$(TARGET_CROSS)ar \
- CC=$(TARGET_CROSS)gcc \
- RANLIB=$(TARGET_CROSS)ranlib
+CGIC_INSTALL_STAGING = YES
define CGIC_BUILD_CMDS
(cd $(@D); \
- $(CGIC_ENV) \
+ $(TARGET_CONFIGURE_OPTS) \
make libcgic.a \
)
endef
--
1.7.8.6
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/3] cgic: new package
2015-01-22 19:11 ` [Buildroot] [PATCH 1/3] " David Bender
2015-01-22 19:11 ` [Buildroot] [PATCH 2/3] Restore cgiFormFileGetTempfileName and make creation permissions more secure David Bender
2015-01-22 19:11 ` [Buildroot] [PATCH 3/3] use TARGET_CONFIGURE_OPTS instead of homegrown ENV David Bender
@ 2015-01-22 21:25 ` Danomi Manchego
2015-01-25 14:53 ` Yann E. MORIN
3 siblings, 0 replies; 10+ messages in thread
From: Danomi Manchego @ 2015-01-22 21:25 UTC (permalink / raw)
To: buildroot
David,
On Thu, Jan 22, 2015 at 2:11 PM, David Bender <codehero@gmail.com> wrote:
snip
> @@ -0,0 +1,36 @@
> +################################################################################
> +#
> +# cgic
> +#
> +################################################################################
> +
> +CGIC_VERSION = 2.06
> +CGIC_SOURCE = cgic206.tar.gz
> +CGIC_SITE = http://boutell.com/cgic
> +CGIC_LICENSE = Custom
> +CGIC_LICENSE_FILES = license.txt
> +
> +CGIC_ENV = AR=$(TARGET_CROSS)ar \
> + CC=$(TARGET_CROSS)gcc \
> + RANLIB=$(TARGET_CROSS)ranlib
> +
Could use TARGET_CONFIGURE_OPTS instead of defining your own CGIC_ENV.
> +define CGIC_BUILD_CMDS
> + (cd $(@D); \
> + $(CGIC_ENV) \
> + make libcgic.a \
> + )
> +endef
Instead of a compound cd/make, why not just use -C?
Should use $(MAKE) as well.
define CGIC_BUILD_CMDS
$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) libcgic.a
endef
Same comment for the steps below.
Danomi -
> +
> +define CGIC_INSTALL_STAGING_CMDS
> + (cd $(@D); \
> + PREFIX=$(STAGING_DIR) make install \
> + )
> +endef
> +
> +define CGIC_INSTALL_TARGET_CMDS
> + (cd $(@D); \
> + PREFIX=$(TARGET_DIR) make install \
> + )
> +endef
> +
> +$(eval $(generic-package))
> --
> 1.7.8.6
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 3/3] use TARGET_CONFIGURE_OPTS instead of homegrown ENV
2015-01-22 19:11 ` [Buildroot] [PATCH 3/3] use TARGET_CONFIGURE_OPTS instead of homegrown ENV David Bender
@ 2015-01-22 21:32 ` Danomi Manchego
2015-01-22 21:51 ` Yann E. MORIN
0 siblings, 1 reply; 10+ messages in thread
From: Danomi Manchego @ 2015-01-22 21:32 UTC (permalink / raw)
To: buildroot
David,
Seems like you should have squashed this into a single "cigic: new
package" patch, no? Forgot to rebase?
Danomi -
On Thu, Jan 22, 2015 at 2:11 PM, David Bender <codehero@gmail.com> wrote:
>
> Signed-off-by: David Bender <codehero@gmail.com>
> ---
> package/cgic/cgic.mk | 7 ++-----
> 1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/package/cgic/cgic.mk b/package/cgic/cgic.mk
> index 378e1cd..a575a16 100644
> --- a/package/cgic/cgic.mk
> +++ b/package/cgic/cgic.mk
> @@ -9,14 +9,11 @@ CGIC_SOURCE = cgic206.tar.gz
> CGIC_SITE = http://boutell.com/cgic
> CGIC_LICENSE = Custom
> CGIC_LICENSE_FILES = license.txt
> -
> -CGIC_ENV = AR=$(TARGET_CROSS)ar \
> - CC=$(TARGET_CROSS)gcc \
> - RANLIB=$(TARGET_CROSS)ranlib
> +CGIC_INSTALL_STAGING = YES
>
> define CGIC_BUILD_CMDS
> (cd $(@D); \
> - $(CGIC_ENV) \
> + $(TARGET_CONFIGURE_OPTS) \
> make libcgic.a \
> )
> endef
> --
> 1.7.8.6
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 3/3] use TARGET_CONFIGURE_OPTS instead of homegrown ENV
2015-01-22 21:32 ` Danomi Manchego
@ 2015-01-22 21:51 ` Yann E. MORIN
0 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2015-01-22 21:51 UTC (permalink / raw)
To: buildroot
Danomi, David,All,
On 2015-01-22 16:32 -0500, Danomi Manchego spake thusly:
> David,
> Seems like you should have squashed this into a single "cigic: new
> package" patch, no? Forgot to rebase?
In fact, I asked David to send his patches as-is, because we discussed
on IRC an issue remaining about licensing information that did not get
saved for some of the packages while it got saved for the others.
I was supposed to review the patches tonight (UTC+1), but got delayed
due to heavy electricity work in the house...
Of course, you are entirely right: the patches about each single package
should have been squahes. That can be done later when we have solved the
licensing info issue.
Thanks for your early review! ;-)
Regards,
Yann E. MORIN.
> On Thu, Jan 22, 2015 at 2:11 PM, David Bender <codehero@gmail.com> wrote:
> >
> > Signed-off-by: David Bender <codehero@gmail.com>
> > ---
> > package/cgic/cgic.mk | 7 ++-----
> > 1 files changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/package/cgic/cgic.mk b/package/cgic/cgic.mk
> > index 378e1cd..a575a16 100644
> > --- a/package/cgic/cgic.mk
> > +++ b/package/cgic/cgic.mk
> > @@ -9,14 +9,11 @@ CGIC_SOURCE = cgic206.tar.gz
> > CGIC_SITE = http://boutell.com/cgic
> > CGIC_LICENSE = Custom
> > CGIC_LICENSE_FILES = license.txt
> > -
> > -CGIC_ENV = AR=$(TARGET_CROSS)ar \
> > - CC=$(TARGET_CROSS)gcc \
> > - RANLIB=$(TARGET_CROSS)ranlib
> > +CGIC_INSTALL_STAGING = YES
> >
> > define CGIC_BUILD_CMDS
> > (cd $(@D); \
> > - $(CGIC_ENV) \
> > + $(TARGET_CONFIGURE_OPTS) \
> > make libcgic.a \
> > )
> > endef
> > --
> > 1.7.8.6
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot at busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/3] cgic: new package
2015-01-22 19:11 ` [Buildroot] [PATCH 1/3] " David Bender
` (2 preceding siblings ...)
2015-01-22 21:25 ` [Buildroot] [PATCH 1/3] cgic: new package Danomi Manchego
@ 2015-01-25 14:53 ` Yann E. MORIN
3 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2015-01-25 14:53 UTC (permalink / raw)
To: buildroot
David, All,
On 2015-01-22 14:11 -0500, David Bender spake thusly:
> Added cgic library.
As for benejson, the three patches adding cgic should be squashed into a
single patch.
I'll handle that and resubmit it as well.
Thanks for your contribution! :-)
Regards,
Yann E. MORIN.
> Signed-off-by: Dave Bender <bender@benegon.com>
> Signed-off-by: David Bender <codehero@gmail.com>
> ---
> package/Config.in | 1 +
> package/cgic/Config.in | 6 ++++
> package/cgic/cgic-0000-prepare_makefile.patch | 40 +++++++++++++++++++++++++
> package/cgic/cgic.mk | 36 ++++++++++++++++++++++
> 4 files changed, 83 insertions(+), 0 deletions(-)
> create mode 100644 package/cgic/Config.in
> create mode 100644 package/cgic/cgic-0000-prepare_makefile.patch
> create mode 100644 package/cgic/cgic.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 266de13..a6fa27d 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -816,6 +816,7 @@ menu "Networking"
> source "package/agentpp/Config.in"
> source "package/c-ares/Config.in"
> source "package/canfestival/Config.in"
> + source "package/cgic/Config.in"
> source "package/cppzmq/Config.in"
> source "package/czmq/Config.in"
> source "package/filemq/Config.in"
> diff --git a/package/cgic/Config.in b/package/cgic/Config.in
> new file mode 100644
> index 0000000..402460d
> --- /dev/null
> +++ b/package/cgic/Config.in
> @@ -0,0 +1,6 @@
> +config BR2_PACKAGE_CGIC
> + bool "cgic"
> + help
> + C CGI library
> +
> + http://www.boutell.com/cgic/
> diff --git a/package/cgic/cgic-0000-prepare_makefile.patch b/package/cgic/cgic-0000-prepare_makefile.patch
> new file mode 100644
> index 0000000..46b7a81
> --- /dev/null
> +++ b/package/cgic/cgic-0000-prepare_makefile.patch
> @@ -0,0 +1,40 @@
> +Binary files cgic206/cgic.o and cgic206-br/cgic.o differ
> +Binary files cgic206/libcgic.a and cgic206-br/libcgic.a differ
> +diff -rupN cgic206/Makefile cgic206-br/Makefile
> +--- cgic206/Makefile 2014-03-16 18:17:11.000000000 -0400
> ++++ cgic206-br/Makefile 2015-01-16 11:18:03.714874000 -0500
> +@@ -1,15 +1,14 @@
> +-CFLAGS=-g -Wall
> +-CC=gcc
> +-AR=ar
> +-RANLIB=ranlib
> + LIBS=-L./ -lcgic
> +
> + all: libcgic.a cgictest.cgi capture
> +
> + install: libcgic.a
> +- cp libcgic.a /usr/local/lib
> +- cp cgic.h /usr/local/include
> +- @echo libcgic.a is in /usr/local/lib. cgic.h is in /usr/local/include.
> ++ cp libcgic.a $(PREFIX)/usr/lib
> ++ cp cgic.h $(PREFIX)/usr/include
> ++ @echo libcgic.a is in $(PREFIX)/usr/lib. cgic.h is in $(PREFIX)/usr/include.
> ++
> ++cgi.o: cgic.c cgic.h
> ++ $(CC) $(CFLAGS) cgic.c -o cgic.o
> +
> + libcgic.a: cgic.o cgic.h
> + rm -f libcgic.a
> +@@ -19,10 +18,10 @@ libcgic.a: cgic.o cgic.h
> + #mingw32 and cygwin users: replace .cgi with .exe
> +
> + cgictest.cgi: cgictest.o libcgic.a
> +- gcc cgictest.o -o cgictest.cgi ${LIBS}
> ++ $(CC) cgictest.o -o cgictest.cgi ${LIBS}
> +
> + capture: capture.o libcgic.a
> +- gcc capture.o -o capture ${LIBS}
> ++ $(CC) capture.o -o capture ${LIBS}
> +
> + clean:
> + rm -f *.o *.a cgictest.cgi capture
> diff --git a/package/cgic/cgic.mk b/package/cgic/cgic.mk
> new file mode 100644
> index 0000000..378e1cd
> --- /dev/null
> +++ b/package/cgic/cgic.mk
> @@ -0,0 +1,36 @@
> +################################################################################
> +#
> +# cgic
> +#
> +################################################################################
> +
> +CGIC_VERSION = 2.06
> +CGIC_SOURCE = cgic206.tar.gz
> +CGIC_SITE = http://boutell.com/cgic
> +CGIC_LICENSE = Custom
> +CGIC_LICENSE_FILES = license.txt
> +
> +CGIC_ENV = AR=$(TARGET_CROSS)ar \
> + CC=$(TARGET_CROSS)gcc \
> + RANLIB=$(TARGET_CROSS)ranlib
> +
> +define CGIC_BUILD_CMDS
> + (cd $(@D); \
> + $(CGIC_ENV) \
> + make libcgic.a \
> + )
> +endef
> +
> +define CGIC_INSTALL_STAGING_CMDS
> + (cd $(@D); \
> + PREFIX=$(STAGING_DIR) make install \
> + )
> +endef
> +
> +define CGIC_INSTALL_TARGET_CMDS
> + (cd $(@D); \
> + PREFIX=$(TARGET_DIR) make install \
> + )
> +endef
> +
> +$(eval $(generic-package))
> --
> 1.7.8.6
>
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/3] Restore cgiFormFileGetTempfileName and make creation permissions more secure
2015-01-22 19:11 ` [Buildroot] [PATCH 2/3] Restore cgiFormFileGetTempfileName and make creation permissions more secure David Bender
@ 2015-01-25 15:53 ` Yann E. MORIN
0 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2015-01-25 15:53 UTC (permalink / raw)
To: buildroot
David, All,
On 2015-01-22 14:11 -0500, David Bender spake thusly:
>
> Signed-off-by: David Bender <codehero@gmail.com>
> ---
> package/cgic/cgic-0001-file_enhancements.patch | 81 ++++++++++++++++++++++++
> 1 files changed, 81 insertions(+), 0 deletions(-)
> create mode 100644 package/cgic/cgic-0001-file_enhancements.patch
>
> diff --git a/package/cgic/cgic-0001-file_enhancements.patch b/package/cgic/cgic-0001-file_enhancements.patch
While fixing the eye-candy in this new cgic package, I stumbled on this
patch you are adding.
First and foremost, you forgot to add a dewscription for this patch, and
you SoB-line.
Without a description, it is not easy to see what this patch does. After
some digging around, I realised it does two things:
- fix the creation of temporary files (good)
- adds a new feature (bad)
Thus, it should have been two separate patches.
cgiFormFileGetTempfileName() is a function that is not called anywhere
in the cgic code, and so I conclude it is only exported as an entrypoint
in the generated library. This is thus a new feature.
We usually refuse to cary feature-patches in Buildroot, unles there is a
very good reason to do so. Since you mention that this is "restoring"
it, do you mean it was present in a previous version and got dropped,
and legacy code might use that function? In this case, it might be OK to
re-add it...
Anyway, I've split this in two.
Regards,
Yann E. MORIN.
> new file mode 100644
> index 0000000..f09a73f
> --- /dev/null
> +++ b/package/cgic/cgic-0001-file_enhancements.patch
> @@ -0,0 +1,81 @@
> +diff -rupN cgic206/cgic.c cgic206_tempfile/cgic.c
> +--- cgic206/cgic.c 2014-03-16 18:17:11.000000000 -0400
> ++++ cgic206_tempfile/cgic.c 2015-01-21 11:58:45.436384908 -0500
> +@@ -22,6 +22,8 @@
> + #define CGICDEBUGEND
> + #endif /* CGICDEBUG */
> +
> ++#define _GNU_SOURCE
> ++
> + #include <stdio.h>
> + #include <string.h>
> + #include <ctype.h>
> +@@ -34,11 +36,11 @@
> + #include <io.h>
> +
> + /* cgic 2.01 */
> +-#include <fcntl.h>
> +
> + #else
> + #include <unistd.h>
> + #endif /* WIN32 */
> ++#include <fcntl.h>
> + #include "cgic.h"
> +
> + #define cgiStrEq(a, b) (!strcmp((a), (b)))
> +@@ -636,16 +638,17 @@ static cgiParseResultType getTempFileNam
> + window between the file's creation and the
> + chmod call (glibc 2.0.6 and lower might
> + otherwise have allowed this). */
> ++ mode_t umode;
> + int outfd;
> ++ umode = umask(0600);
> + strcpy(tfileName, cgicTempDir "/cgicXXXXXX");
> +- outfd = mkstemp(tfileName);
> ++ outfd = mkostemp(tfileName, O_CLOEXEC | O_NOATIME);
> ++ umask(umode);
> + if (outfd == -1) {
> + return cgiParseIO;
> + }
> +- close(outfd);
> +- /* Fix the permissions */
> +- if (chmod(tfileName, 0600) != 0) {
> +- unlink(tfileName);
> ++
> ++ if (close(outfd)) {
> + return cgiParseIO;
> + }
> + #else
> +@@ -1275,6 +1278,20 @@ cgiFormResultType cgiFormFileContentType
> + }
> + }
> +
> ++const char* cgiFormFileGetTempfileName(
> ++ char* name)
> ++{
> ++ cgiFormEntry *e;
> ++ e = cgiFormEntryFindFirst(name);
> ++ if (!e) {
> ++ return NULL;
> ++ } else if (!strlen(e->tfileName)) {
> ++ return NULL;
> ++ } else {
> ++ return e->tfileName;
> ++ }
> ++}
> ++
> + cgiFormResultType cgiFormFileSize(
> + char *name, int *sizeP)
> + {
> +diff -rupN cgic206/cgic.h cgic206_tempfile/cgic.h
> +--- cgic206/cgic.h 2014-03-16 18:17:11.000000000 -0400
> ++++ cgic206_tempfile/cgic.h 2015-01-21 11:53:02.915148026 -0500
> +@@ -141,6 +141,8 @@ extern cgiFormResultType cgiFormRadio(
> + char *name, char **valuesText, int valuesTotal,
> + int *result, int defaultV);
> +
> ++extern const char* cgiFormFileGetTempfileName(char* name);
> ++
> + /* The paths returned by this function are the original names of files
> + as reported by the uploading web browser and shoult NOT be
> + blindly assumed to be "safe" names for server-side use! */
> --
> 1.7.8.6
>
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-01-25 15:53 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-16 16:23 [Buildroot] [PATCH 1/1] cgic: new package David Bender
2015-01-17 19:21 ` Baruch Siach
2015-01-22 19:11 ` [Buildroot] [PATCH 1/3] " David Bender
2015-01-22 19:11 ` [Buildroot] [PATCH 2/3] Restore cgiFormFileGetTempfileName and make creation permissions more secure David Bender
2015-01-25 15:53 ` Yann E. MORIN
2015-01-22 19:11 ` [Buildroot] [PATCH 3/3] use TARGET_CONFIGURE_OPTS instead of homegrown ENV David Bender
2015-01-22 21:32 ` Danomi Manchego
2015-01-22 21:51 ` Yann E. MORIN
2015-01-22 21:25 ` [Buildroot] [PATCH 1/3] cgic: new package Danomi Manchego
2015-01-25 14:53 ` Yann E. MORIN
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.