1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/client
Doug Davis 12b6083c8f Remove panic in nat package on invalid hostport
Closes #14621

This one grew to be much more than I expected so here's the story... :-)
- when a bad port string (e.g. xxx80) is passed into container.create()
  via the API it wasn't being checked until we tried to start the container.
- While starting the container we trid to parse 'xxx80' in nat.Int()
  and would panic on the strconv.ParseUint().  We should (almost) never panic.
- In trying to remove the panic I decided to make it so that we, instead,
  checked the string during the NewPort() constructor.  This means that
  I had to change all casts from 'string' to 'Port' to use NewPort() instead.
  Which is a good thing anyway, people shouldn't assume they know the
  internal format of types like that, in general.
- This meant I had to go and add error checks on all calls to NewPort().
  To avoid changing the testcases too much I create newPortNoError() **JUST**
  for the testcase uses where we know the port string is ok.
- After all of that I then went back and added a check during container.create()
  to check the port string so we'll report the error as soon as we get the
  data.
- If, somehow, the bad string does get into the metadata we will generate
  an error during container.start() but I can't test for that because
  the container.create() catches it now.  But I did add a testcase for that.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-07-17 13:02:54 -07:00
..
attach.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
build.go api/client: unify format of args check 2015-07-08 17:29:47 +08:00
cli.go Add support for DOCKER_CONFIG/--config to specific config file dir 2015-07-10 12:51:34 -07:00
client.go client.StatusError don't be returned as a pointer 2015-04-16 01:27:07 +08:00
commit.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
cp.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
create.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
diff.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
events.go Windows: Security warning based on server OS 2015-06-26 10:33:45 -07:00
exec.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
export.go Unify docker commands' usage in man and help 2015-07-02 10:33:26 +08:00
help.go clean some redundant else clauses 2015-05-19 10:54:04 +08:00
hijack.go add support for base path in docker cli -H 2015-07-08 15:42:40 -07:00
history.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
images.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
import.go Windows: Security warning based on server OS 2015-06-26 10:33:45 -07:00
info.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
inspect.go api/client: unify format of args check 2015-07-08 17:29:47 +08:00
kill.go api/client: Allow for multi-line usage help 2015-06-10 16:14:45 -07:00
load.go client/load: tiny typo fix 2015-07-03 08:37:27 +08:00
login.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
logout.go api/client: unify format of args check 2015-07-08 17:29:47 +08:00
logs.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
network.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
pause.go api/client: unify format of args check 2015-07-08 17:29:47 +08:00
port.go Remove panic in nat package on invalid hostport 2015-07-17 13:02:54 -07:00
ps.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
pull.go Unify docker commands' usage in man and help 2015-07-02 10:33:26 +08:00
push.go api/client: unify format of args check 2015-07-08 17:29:47 +08:00
rename.go api/client: unify format of args check 2015-07-08 17:29:47 +08:00
restart.go api/client: Allow for multi-line usage help 2015-06-10 16:14:45 -07:00
rm.go api/client: Allow for multi-line usage help 2015-06-10 16:14:45 -07:00
rmi.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
run.go Windows: Exec driver 2015-07-10 13:36:56 -07:00
save.go Windows: Security warning based on server OS 2015-06-26 10:33:45 -07:00
search.go api/client: close the returned io.ReadCloser 2015-07-08 10:06:25 +08:00
service.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
start.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
stats.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
stats_unit_test.go change memory usage display 2015-04-11 20:04:34 +08:00
stop.go api/client: Allow for multi-line usage help 2015-06-10 16:14:45 -07:00
tag.go api/client: Allow for multi-line usage help 2015-06-10 16:14:45 -07:00
top.go Windows: Remove meaningless warnings on docker info 2015-07-10 10:06:20 -07:00
unpause.go api/client: unify format of args check 2015-07-08 17:29:47 +08:00
utils.go Merge pull request #14518 from Microsoft/10662-infowarnings 2015-07-13 14:30:57 -07:00
version.go add --format flag to docker version 2015-07-13 19:10:56 -04:00
wait.go api/client: Allow for multi-line usage help 2015-06-10 16:14:45 -07:00