Skip to content

Commit 533301e

Browse files
committed
release 1.6.2: fix port detection with NGINX >= 1.27.0
oops: use local_sockaddr instead of the remote one Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 87829cc commit 533301e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

.cproject

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</extensions>
1919
</storageModule>
2020
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
21-
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools,org.eclipse.cdt.build.core.buildType=org.eclipse.linuxtools.cdt.autotools.core.buildType.default" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1562680719" name="Build (GNU)" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=unix:///var/run/docker.sock" parent="org.eclipse.linuxtools.cdt.autotools.core.configuration.build">
21+
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools,org.eclipse.cdt.build.core.buildType=org.eclipse.linuxtools.cdt.autotools.core.buildType.default" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1562680719" name="Build (GNU)" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=unix:///var/run/docker.sock,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=" parent="org.eclipse.linuxtools.cdt.autotools.core.configuration.build">
2222
<folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.1562680719." name="/" resourcePath="">
2323
<toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.617277945" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
2424
<targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.359991688" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
@@ -86,7 +86,7 @@
8686
</extensions>
8787
</storageModule>
8888
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
89-
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools,org.eclipse.cdt.build.core.buildType=org.eclipse.linuxtools.cdt.autotools.core.buildType.debug" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.debug.1551656597" name="Debug (GNU)" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=unix:///var/run/docker.sock" parent="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.debug">
89+
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.linuxtools.cdt.autotools.core.buildArtefactType.autotools,org.eclipse.cdt.build.core.buildType=org.eclipse.linuxtools.cdt.autotools.core.buildType.debug" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser" id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.debug.1551656597" name="Debug (GNU)" optionalBuildProperties="org.eclipse.cdt.docker.launcher.containerbuild.property.volumes=,org.eclipse.cdt.docker.launcher.containerbuild.property.connection=unix:///var/run/docker.sock,org.eclipse.cdt.docker.launcher.containerbuild.property.selectedvolumes=" parent="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.debug">
9090
<folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.configuration.build.debug.1551656597." name="/" resourcePath="">
9191
<toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.debug.1772566252" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain.debug">
9292
<targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.debug.1422301246" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.debug"/>
@@ -190,19 +190,18 @@
190190
</target>
191191
<target name="clang-format" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
192192
<buildCommand>make</buildCommand>
193-
<buildArguments/>
194193
<buildTarget>clang-format</buildTarget>
195194
<stopOnError>true</stopOnError>
196195
<useDefaultCommand>true</useDefaultCommand>
197-
<runAllBuilders>true</runAllBuilders>
196+
<runAllBuilders>false</runAllBuilders>
198197
</target>
199198
<target name="check" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
200199
<buildCommand>make</buildCommand>
201200
<buildArguments/>
202201
<buildTarget>check</buildTarget>
203202
<stopOnError>true</stopOnError>
204203
<useDefaultCommand>true</useDefaultCommand>
205-
<runAllBuilders>true</runAllBuilders>
204+
<runAllBuilders>false</runAllBuilders>
206205
</target>
207206
</buildTargets>
208207
</storageModule>

src/server/nginx.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,19 @@ static void _oauth2_nginx_port_copy(oauth2_nginx_request_context_t *ctx)
105105
struct sockaddr_in6 *sin6;
106106
#endif
107107

108-
switch (ctx->r->connection->sockaddr->sa_family) {
108+
switch (ctx->r->connection->local_sockaddr->sa_family) {
109109
#if (NGX_HAVE_INET6)
110110
case AF_INET6:
111-
sin6 = (struct sockaddr_in6 *)ctx->r->connection->sockaddr;
111+
sin6 =
112+
(struct sockaddr_in6 *)ctx->r->connection->local_sockaddr;
112113
port = ntohs(sin6->sin6_port);
113114
#endif
114115
#if (NGX_HAVE_UNIX_DOMAIN)
115116
case AF_UNIX:
116117
port = 0;
117118
#endif
118119
default: /* AF_INET */
119-
sin = (struct sockaddr_in *)ctx->r->connection->sockaddr;
120+
sin = (struct sockaddr_in *)ctx->r->connection->local_sockaddr;
120121
port = ntohs(sin->sin_port);
121122
}
122123

test/check_nginx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ static void setup(void)
4949
_request->pool = ngx_create_pool(1024, NULL);
5050
_request->connection = oauth2_mem_alloc(sizeof(ngx_connection_t));
5151
_request->connection->log = NULL;
52-
_request->connection->sockaddr =
52+
_request->connection->local_sockaddr =
5353
oauth2_mem_alloc(sizeof(struct sockaddr_in));
54-
_request->connection->sockaddr->sa_family = AF_INET;
55-
((struct sockaddr_in *)_request->connection->sockaddr)->sin_port =
54+
_request->connection->local_sockaddr->sa_family = AF_INET;
55+
((struct sockaddr_in *)_request->connection->local_sockaddr)->sin_port =
5656
htons(8080);
5757
_request->http_connection =
5858
oauth2_mem_alloc(sizeof(ngx_http_connection_t));

0 commit comments

Comments
 (0)